This commit is contained in:
mpabi 2024-03-26 09:29:31 +00:00
parent a957939eef
commit b6c596ab49
1 changed files with 24 additions and 0 deletions

View File

@ -5,6 +5,27 @@
//int8_t x = 1, y = 2, z[10];
//int8_t *ip; /* ip to wskaźnik do obiektu typu int */
void swap_ptr (int8_t *x, int8_t *y) {
int8_t tmp;
tmp = *x;
*x = *y;
*y = tmp;
}
// -----------------------------------------------
void swap(int8_t x, int8_t y) {
int8_t tmp;
tmp = x;
x = y;
y = tmp;
}
int main() {
// ip = &x; /* ip wskazuje teraz x */
@ -19,6 +40,9 @@ int main() {
*mip = 0; /* x ma teraz wartość 0 */
mip = &mz[0]; /* ip wskazuje teraz z[0] */
swap (mx, my);
swap_ptr (&mx, &my);
return 1;
}