Recent questions tagged pointers

0 votes
0 answers
241
1 votes
1 answer
242
#include <stdio.h int main() { short int a[10]; int i=0; for(i=0;i<10;i++) a[i] = 300 + i; char *c = (char*)a; printf("%d\n", *(c+4)); int *n = (int*)a; printf("%d\n",*(n...
6 votes
2 answers
244
What is the output of this program?#include <stdio.h int main() { char *ptr; char string[] = "Hello 2017"; ptr = string; ptr += 4; printf("%s",++ptr); }Hello 2017ello 201...
1 votes
2 answers
246
What is the output of the following C code int main( ) { int p[5] = {10, 11, 12, 13, 14}; int *ptr = (int *) (&p + 1); printf(“%d %d”, *(p + 1), *(ptr – 1)); }
2 votes
0 answers
248
0 votes
1 answer
250
0 votes
1 answer
251
2 votes
1 answer
252
int main() { int i,n; int x = 123456789; void *a = &x; unsigned char *c1 = (unsigned char*)a; for(i=0;i< sizeof a;i++) { printf("%u ",*(c1+i)); } char *c2 = (char*)a; pri...
4 votes
2 answers
254
In C/C++ an array of pointers is same as(A) Pointer to array(B) Pointer to pointer(C) Pointer to function (D) Pointer to structure
7 votes
2 answers
255
4 votes
4 answers
256
What is the output of this C code?#include<stdio.h void main() { int k=5; int *p=&k; int m=&p; printf("%d %d %d",k,*p, m); }5 5 5 5 5 junk5 junk junkcompile time error
0 votes
1 answer
258
main(){char *c , ch[10];int *i , j[10];float *f , g[10];int x;c = ch;i = j;f = g;for ( x=0 ; x<=10 ; x++ )printf("%p %p %p\n" , c+x , i+x , f+x);}
0 votes
1 answer
259
#include <stdio.h int main() { int i = 10; int *const p = &i; fd(&p); printf("%d\n", *p); } void fd(int p) { int j = 11; *p = &j; printf("%d\n", p); }
0 votes
1 answer
260
0 votes
3 answers
261
what is this lvalue error all about . pl explain in simple words
0 votes
1 answer
264
#include <stdio.h int main() { struct node { int a; int b; int c; }; struct node s = { 3, 5, 6 }; struct node *pt = &s; printf("%d\n", *((int*)pt+1)); return 0; }
0 votes
1 answer
265
#include <stdio.h int main(void) { char a[5] = { 1, 2, 3, 4, 5 }; char *ptr = (char*)(&a + 1); printf("%d %d\n", *(a + 1), *(ptr - 1)); return 0; }(a) Compile Error (b) 2...
0 votes
1 answer
266
0 votes
1 answer
267
0 votes
1 answer
270
#include<stdio.h int main() { int a[10][20][30] = {0}; int *b = a; int *c = a+1; printf("%ld", c-b); return 0; }