The way to change the 'value' that the two pointers point to can be found with just a little search... I can't find a way to change the 'address' that the two pointers point to... Even if I try to do it alone, there are errors or compiles, the results are weird...crying For example, when changing the value,
void swap(int *a, int *b){
int temp;
temp = *a;
*a = *b;
*b = temp;
}
You can do it like this, but if you try to change the address, A = b; In this part, only the error "Address cannot be substituted for address" appears repeatedly. How can I change the addresses? Please I beg you.
pointer address
int swap(int ** a, int ** b) {
int * temp;
...
}
I'll have to do this.
Try initializing pointer variables a and b (assigning actual address values).
For example,
int main(void) {
int *a, *b;
int c = 1;
int d = 2;
a = &c;
b = &d;
a = b;
printf("%d", *a);
}
© 2024 OneMinuteCode. All rights reserved.