in Programming in C
772 views
0 votes
0 votes
#include <stdio.h>
int main()
{
    int a[] = {50, 60, 10, 30, 40, 20 };
    int *b[] = {a+3, a+4, a, a+2, a+1, a+5 };
    int **c = b;
    c++;
    printf("%u, %u, %u\n", c-b, *c - a, **c);
    return 0;
}
in Programming in C
by
772 views

3 Comments

Answer : 1,4,40
1
1

@Prashant. I am not getting this,

when we do, c-b why we got 1 as answer, likewise when we do *c-a why we got 4 as answer ?

Here i modified to programme to see the address, i think c-b should be 8 and *c-a should be 16. Where i am going wrong ?

0
0
3347544000 is nothing the base address of the array b.

3347544008 is nothing the 2nd element address of the array b.  which is contain by c after c++.

3347544008 - 3347544000 = 8 but we know pointer take 8 byte here . so divide by size of pointer is needed. so 8/8= 1
1
1

1 Answer

4 votes
4 votes
Best answer

Output will be 

1,4,40

selected by

Related questions