C programming question
-
why the output of program come as 65486, 65486?? Can anyone explain ???? int main() { int arr[] = {12, 14, 15, 23, 45}; printf("%u, %u\n", arr, &arr); return 0; }
-
why the output of program come as 65486, 65486?? Can anyone explain ???? int main() { int arr[] = {12, 14, 15, 23, 45}; printf("%u, %u\n", arr, &arr); return 0; }
Both
arr
and&arr
evaluate to the same address. See here - http://stackoverflow.com/questions/2528318/c-how-come-an-arrays-address-is-equal-to-its-value[^]«_Superman_» _I love work. It gives me something to do between weekends.
-
why the output of program come as 65486, 65486?? Can anyone explain ???? int main() { int arr[] = {12, 14, 15, 23, 45}; printf("%u, %u\n", arr, &arr); return 0; }
Pointer name will give the base address of the array. Hence arr( pointer name ) and &arr both will point to the same address.