int main(){
char *str1="Hi", *str2 = "Bye";
printf("%u,%u\n",&str1,str1);
int arr[5]={1,2,3,4,5};
printf("%u,%u",arr,&arr);
}
What is happening here? str
and &str
give different addresses and arr
and &arr
give same.
My understanding is that arr
points to address of first element i.e &arr[0]
and &arr
will give also the same address but it is address of whole arr[5]
. If we increment &arr
by 1 then it will point to next element of arr[4]. But problem is that why this process is different in case of string. Please help me to visualize the concept here.