0
Pointers C
void test(int k); int main() { int i = 0; printf("The address of i is %x\n", &i); test(i); printf("The address of i is %x\n", &i); test(i); return 0; } void test(int k) { printf("The address of k is %x\n", &k); } Why does it give a different adress when "i" is accessed through the function test and ehen through printf?
1 Réponse
0
Because i and k are different variables, therefore they allocate in memory on different places hence have different addresses