355 views
0 votes
0 votes
a and &a are the same thing where a is array name? I am unable to understand diff between  (a+1) and (&a+1) when assigned to a pointer
 
#include <stdio.h>
int main()
{
    int a[5] = {1,2,3,4,5};
    int *ptr = (int*)(&a+1);
    printf("%d %d", *(a+1), *(ptr-1));
    return 0;
}

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
2
rajinder singh asked Sep 2, 2018
190 views
What will be value inside an unintialized pointer eg case1:main(){Int *p;//local } Or case2:Int *p;// global Main(){}
1 votes
1 votes
3 answers
4
UK asked Mar 15, 2016
714 views
What is the difference when I write in program mynode * head; add_node(&head,10); add_node( struct node head, into value);To this mynode *head; add_node (head,10); add_...