2,395 views
1 1 vote

Tell me the difference :
&(arr+1)   and    &arr+1 

2 Answers

5 5 votes
The name of the array gives the address of the 0th element. So if we add 1 to the name of the array it will contain the address of the next element.

But if we look at the other one "&arr" this gives the address of the entire array and now when we increment it by one it will contain the address of the second array of same size.
• edited by
Position:
Show:

Related questions

6 6 votes
1 1 answer
268
268 views
GO Classes asked Jun 23
268 views
What will happen when the following code is compiled?#include <stdio.h int main() { int a[] = {10, 20, 30}; a = a + 1; printf("%d", *a); return 0; }$\texttt{10}$ $\texttt...
7 7 votes
2 2 answers
343
343 views
GO Classes asked Jun 23
343 views
What is the output of the following code?#include <stdio.h int main() { int a[] = {5, 10, 15, 20}; int *p = a + 1; printf("%d %d %td", *(p + 1), p , (p + 2) - a); return ...
7 7 votes
2 2 answers
372
372 views
GO Classes asked Jun 22
372 views
What is the output of the following code?#include <stdio.h int main() { int a[] = {2, 4, 6, 8, 10}; printf("%d %d %d", *a, *(a + 3), 3[a]); return 0; }$\texttt{2 6 8}$ $\...
0 0 votes
1 1 answer
1.5k
1.5k views
aditi19 asked Sep 13, 2018
1,527 views
what is wrong with this code? It shows segmentation fault#include<stdio.h>#include<stdlib.h>void main(){ int i,j,count=1; int a=(int )malloc(3*sizeof(int*)); fo...