Recent questions tagged pointers

0 votes
1 answer
151
int main() { char *p="abc"; char *q="abc123"; while(*p++=*q++) printf("%c %c",*p,*q); }The Output is b bc c 1a 2b 3cHere explain how did 1a 2b 3c will come as at that tim...
0 votes
1 answer
152
What would be the equivalent pointer expression for referring the array element a[i][j][k][l]?A. ((((a+i)+j)+k)+l)B. *(*(*(*(a+i)+j)+k)+l)C. (((a+i)+j)+k+l)D. ...
0 votes
0 answers
154
0 votes
2 answers
155
0 votes
1 answer
156
#include<stdio.h int main() { char *x; int a = 512; x = (char *) &a; x[0] = 1; x = 2; printf("%d\n",a); return 0; }What is the output of above program?Machine dependent$...
0 votes
0 answers
157
0 votes
2 answers
158
0 votes
0 answers
160
int* func() { int* mem = malloc(1024); return mem; } int* mem = func();Can anyone pls explain the code?
1 votes
0 answers
163
main(){ int a ;char *x;x = ( char *)&a;a = 512 ;x[0] = 2 ;x = 2 ;printf("%d",a);}
3 votes
0 answers
164
Answer given is option C. How ?I gather that the character pointer will point to the first byte of the integer whose value is 255.But after that what should be the soluti...
1 votes
0 answers
165
Consider below code My ans : mech,g,mech Given ans : mech,g,civilthird printf statement is somwhat confusing ..please explain
0 votes
0 answers
170
1 votes
2 answers
171
Plz Explain with a diagram .
2 votes
1 answer
172
What is the output of the following ?int main(){int arr [3] ={1,2,3,4,5,6,7,8,9,10,11,12};printf("%d%d", a -a[0], a [0]-a[0][0]);return 0;}
0 votes
1 answer
173
int *p, A[3]={0,1,2};p=A;*(P+2)=5;p=A++;*P=7; what are the values stored in the atray A from index 0 to index 2 after execution of the above cod?
1 votes
1 answer
174
Please explain the working of pointers in this question. I'm unable to understand how we are getting this answer.
0 votes
1 answer
176
Hi,Why multiple dereferencing is not creating problem in the following program ?https://ideone.com/3Li06v (Check line 1,2 & 3. all are giving same O/P)
7 votes
3 answers
177
What is the output of the following program?#include<stdio.h int main() { int array[]={10, 20, 30, 40}; printf(“%d”, -2[array]); return 0; }$-60$$-30$$60$Garbage valu...
0 votes
1 answer
178
#include<stdio.h int main(){ int a[] = {1, 2, 3, 4, 5, 6}; int *ptr = (int*)(&a+1); printf("%d ", *(ptr-1) ); return 0;}Give the output with explanation.
1 votes
1 answer
179
What will be the output ?#include<stdio.h>int main(){ char *str1 = "xyz"; char *str2 = "xyz"; if(str1 == str2) printf("equal"); else printf("une...
3 votes
1 answer
180