Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Pointers Questions
The operator used to get value at address stored in a pointer variable is
In which header file is the NULL macro defined?
What is (void*)0?
If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
Can you combine the following two statements into one? char *p; p = (char*) malloc(100);
A pointer is
How many bytes are occupied by near, far and huge pointers (DOS)?
What would be the equivalent pointer expression for referring the array element a[i][j][k][l]
What will be the output of the program? #include<stdio.h> int main() { char *str; str = "%d\n"; str++; str++; printf(str-2, 300); return 0; }
What will be the output of the program? #include<stdio.h> int main() { char *str; str = "%s"; printf(str, "K\n"); return 0; }
What will be the output of the program? #include<stdio.h> int main() { char str1[] = "India"; char str2[] = "CURIOUSTAB"; char *s1 = str1, *s2=str2; while(*s1++ = *s2++) printf("%s", str1); printf("\n"); return 0; }
What will be the output of the program assuming that the array begins at the location 1002 and size of an integer is 4 bytes? #include<stdio.h> int main() { int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1)); return 0; }
What will be the output of the program assuming that the array begins at location 1002? #include<stdio.h> int main() { int a[2][3][4] = { {1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2}, {2, 1, 4, 7, 6, 7, 8, 9, 0, 0, 0, 0} }; printf("%u, %u, %u, %d\n", a, *a, **a, ***a); return 0; }
What will be the output of the program? #include<stdio.h> #include<string.h> int main() { int i, n; char *x="Alice"; n = strlen(x); *x = x[n]; for(i=0; i<=n; i++) { printf("%s ", x); x++; } printf("\n", x); return 0; }
What will be the output of the program If the integer is 4bytes long? #include<stdio.h> int main() { int ***r, **q, *p, i=8; p = &i; q = &p; r = &q; printf("%d, %d, %d\n", *p, **q, ***r); return 0; }
What will be the output of the program? #include<stdio.h> int main() { int x=30, *y, *z; y=&x; /* Assume address of x is 500 and integer is 4 byte size */ z=y; *y++=*z++; x++; printf("x=%d, y=%d, z=%d\n", x, y, z); return 0; }
What will be the output of the program? #include<stdio.h> void fun(void *p); int i; int main() { void *vptr; vptr = &i; fun(vptr); return 0; } void fun(void *p) { int **q; q = (int**)&p; printf("%d\n", **q); }
What will be the output of the program? #include<stdio.h> int main() { int arr[3] = {2, 3, 4}; char *p; p = arr; p = (char*)((int*)(p)); printf("%d, ", *p); p = (int*)(p+1); printf("%d", *p); return 0; }
If the size of integer is 4bytes, What will be the output of the program? #include<stdio.h> int main() { int arr[] = {12, 13, 14, 15, 16}; printf("%d, %d, %d\n", sizeof(arr), sizeof(*arr), sizeof(arr[0])); return 0; }
What will be the output of the program? #include<stdio.h> int main() { char *p; p="hello"; printf("%s\n", *&*&p); return 0; }
1
2