#include<stdio.h> int main() { int arr[2][2][2] = {10, 2, 3, 4, 5, 6, 7, 8}; int *p, *q; p = &arr[1][1][1]; q = (int*) arr; printf("%d, %d\n", *p, *q); return 0; }
#include<stdio.h> int main() { int i, a[] = {2, 4, 6, 8, 10}; change(a, 5); for(i=0; i<=4; i++) printf("%d, ", a[i]); return 0; } void change(int *b, int n) { int i; for(i=0; i<n; i++) *(b+1) = *(b+i)+5; }
#include<stdio.h> power(int**); int main() { int a=5, *aa; /* Address of 'a' is 1000 */ aa = &a; a = power(&aa); printf("%d\n", a); return 0; } power(int **ptr) { int b; b = **ptr***ptr; return (b); }
#include<stdio.h> int main() { printf("%d, %d\n", sizeof(NULL), sizeof("")); return 0; }
#include<stdio.h> int main() { char str[] = "peace"; char *s = str; printf("%s\n", s++ +3); return 0; }
#include<stdio.h> int main() { printf("%c\n", 7["CuriousTab"]); return 0; }
#include<stdio.h> int main() { char str[20] = "Hello"; char *const p=str; *p='M'; printf("%s\n", str); return 0; }
#include<stdio.h> int main() { static char *s[] = {"black", "white", "pink", "violet"}; char **ptr[] = {s+3, s+2, s+1, s}, ***p; p = ptr; ++p; printf("%s", **p+1); return 0; }
#include<stdio.h> int *check(static int, static int); int main() { int *c; c = check(10, 20); printf("%d\n", c); return 0; } int *check(static int i, static int j) { int *p, *q; p = &i; q = &j; if(i >= 45) return (p); else return (q); }
#include<stdio.h> int main() { void *vp; char ch=74, *cp="JACK"; int j=65; vp=&ch; printf("%c", *(char*)vp); vp=&j; printf("%c", *(int*)vp); vp=cp; printf("%s", (char*)vp+2); return 0; }
#include<stdio.h> void fact(int*); int main() { int i=5; fact(&i); printf("%d\n", i); return 0; } void fact(int *j) { static int s=1; if(*j!=0) { s = s**j; *j = *j-1; fact(j); /* Add a statement here */ } }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.