#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; }
#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; }
It may give different output in other platforms (depends upon compiler and machine). The online C compiler given in this site will give the Option C as output (it runs on Linux platform).
#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; }
#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; }
#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; }
#include<stdio.h> int main() { char *str; str = "%s"; printf(str, "K\n"); return 0; }
#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; }
#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); }
#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; }
#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; }
#include<stdio.h> int main() { char *p; p="hello"; printf("%s\n", *&*&p); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.