On Mon, Jul 25, 2011 at 8:20 PM, swetha rahul <swetharahu...@gmail.com> wrote:
>
> int main()
> {
>     int a[5]={1,2,3,4,5};
>     int *ptr=&a;
>     printf("%d",*(ptr));
>     getch();
> }
>
> Then why this prints 1.. ??

Here, ptr variable gets the starting address of the array 'a'. the
starting address by default is the address of the first element of the
array.
However, ptr is a pointer to only one integer and not the entire array.
that is the reason why, printing the *ptr value just prints the first one

Regards,
B.C.Someshwar


--
'Talk sense to a fool and he calls you foolish.' - Euripides

My Blog:  somsekaran.wordpress.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to