+ 2

Plz... Somebody explain me this...

What is the output of this code? #include <stdio.h> int main() { static int a[]={ 10,20,30,40,50 }; static int *p[] = {a, a+3, a+4, a+1, a+2}; int **ptr = p; ptr++; printf("%d%d", ptr - p, **ptr); }

9th Jul 2020, 2:37 AM
Sp Maurya
Sp Maurya - avatar
2 Respostas
+ 6
**ptr has p or a **ptr++ has p+1 i.e.1 indexed element of p i.e. a+3 i.e. 3 index element of a i.e. 40 **ptr-p is actually p++ - p i.e. 1 So output: 1 40
9th Jul 2020, 3:06 AM
preeti dudi
preeti dudi - avatar
+ 1
preeti dudi got it 🙂👍🏻👍🏻
9th Jul 2020, 3:12 AM
Sp Maurya
Sp Maurya - avatar