-1

in running the code below , i got this output

num= 2359120, addr of num=2359120, *num=10,addr of num[0]=2359120

I can't comprehend how num and &num have the same value. any help, please? i know that the name of an array is a pointer itself

#include <math.h>
#include<stdio.h>
main()
{
int num[]={10,20,30,40,50};
printf("num= %d, addr of num=%d, *num=%d,addr of num[0]=%d\n",num,&num,*num,&num[0]);
}
Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680

1 Answers1

0

name of array num is same as the address of the array &num which is same as the address of the first element &num[0] and hence, your output.

Ganesh
  • 5,880
  • 2
  • 36
  • 54