C pointers - Point to the same address

后端 未结 7 1602
野趣味
野趣味 2021-02-10 15:38
#include 
#include 

void foo(int *a, int *b);

void foo(int *a, int *b) {
    *a = 5;
    *b = 6;
    a = b;
}

int main(void) {
    int          


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-10 16:12

    I'm not sure what you're going after... if it's to get a and b to contain the same value, try *a = *b.

提交回复
热议问题