This commit is contained in:
parent
a957939eef
commit
b6c596ab49
|
@ -5,6 +5,27 @@
|
||||||
//int8_t x = 1, y = 2, z[10];
|
//int8_t x = 1, y = 2, z[10];
|
||||||
//int8_t *ip; /* ip to wskaźnik do obiektu typu int */
|
//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() {
|
int main() {
|
||||||
|
|
||||||
// ip = &x; /* ip wskazuje teraz x */
|
// ip = &x; /* ip wskazuje teraz x */
|
||||||
|
@ -19,6 +40,9 @@ int main() {
|
||||||
*mip = 0; /* x ma teraz wartość 0 */
|
*mip = 0; /* x ma teraz wartość 0 */
|
||||||
mip = &mz[0]; /* ip wskazuje teraz z[0] */
|
mip = &mz[0]; /* ip wskazuje teraz z[0] */
|
||||||
|
|
||||||
|
swap (mx, my);
|
||||||
|
swap_ptr (&mx, &my);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue