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; } Kiran Karwa asked Dec 8, 2017 Kiran Karwa 355 views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply Anu007 commented Dec 8, 2017 reply Follow Share a= what a contain i.e. address of array &a= what is the address of a itself not what inside a. 2,5 is answer 1 votes 1 votes Ashwin Kulkarni commented Dec 8, 2017 reply Follow Share Here a is address of 1st element of an array. &a is means address a pointer pointing to a. (address of an array) when you increment &a by 1 due to address arithmetic pointer will now points to next element after last element! Because it is incremented by whole array size. a+1 inside pointer will move on to 2nd element of an array. *(a+1) = value inside that address. = 2 Hence ans is 2,5 1 votes 1 votes Kiran Karwa commented Dec 9, 2017 reply Follow Share @Ashwin Kulkarni When I run the following code both give me same output i.e a and &a print the same address..could u pls tell me why is it so? #include<stdio.h> int main(){ int a[2]={1,2}; printf("%d\n",a); printf("%d",&a); return 0; } Here the output I get is: 269667984 269667984 0 votes 0 votes Please log in or register to add a comment.