1,053 views
1 1 vote

Plz Explain with a diagram .

2 Answers

Best answer
2 2 votes
Address Strings
1000 GATE
2000 CSIT
3000 2018

Assume pointer size = 8byte

Char size = 1byte

Elements of Array S 1000 2000 3000
Address 4000 4008 4016
Elements of Array P 4016 4008 4000
Address 5000 5008 5016

p=5000

**++p+1 =**++5000+1 = **5008+1 = *4008+1 = 2000+1 = 2001 

o/p: SIT

• selected by
0 0 votes
**++ptr+1=**(++ptr)+1=**(p+1)+1=*(s+1)+1

*(s+1)=s[1]=CSIT

hence *(s+1)+1=SIT

answer is (B)
Position:
Show:

Related questions

8 8 votes
1 1 answer
299
299 views
GO Classes asked Jun 19
299 views
What is the output of the following code?#include <stdio.h void fun(int a[], int *p) { a = a + 5; *(p + 2) = *(p + 2) + 10; p++; *p = *p + 1; } int main() { int arr[] =...
6 6 votes
1 1 answer
242
242 views
GO Classes asked Jun 19
242 views
What is the output of the following code?#include <stdio.h int main() { int arr[] = {10, 20, 30}; int *p = arr; printf("%d %d", *p, *(arr + 2)); return 0; }$\texttt{10 20...
8 8 votes
1 1 answer
242
242 views
GO Classes asked Jun 6
242 views
What is the output of the following code?#include <stdio.h void change(int *p, int *q) { *p = *p + 4; *q = *p + *q; p = q; *p = *p - 3; } int main() { int a = 6, b = 10; ...
8 8 votes
1 1 answer
248
248 views
GO Classes asked Jun 6
248 views
What is the output of the following code?#include <stdio.h int main() { int a = 8, b = 12; int *p = &a; int *q = &b; *p = *p + *q; q = p; *q = *q - 5; printf("%d %d", a, ...