#include<stdio.h> int main() { int y=128; const int x=y; printf("%d\n", x); return 0; }
Step 2: const int x=y; The constant variable 'x' is declared as an integer and it is initialized with the variable 'y' value.
Step 3: printf("%d\n", x); It prints the value of variable 'x'.
Hence the output of the program is "128"
#include<stdio.h> int X=40; int main() { int X=20; printf("%d\n", X); return 0; }
/* myprog.c */ #include<stdio.h> #include<stdlib.h> int main(int argc, char **argv) { int i; for(i=1; i<=3; i++) printf("%u\n", &argv[i]); return 0; }If the first value printed by the above program is 65517, what will be the rest of output?
#include<stdio.h> #include<stdlib.h> int main() { int *p; p = (int *)malloc(20); /* Assume p has address of 1314 */ free(p); printf("%u", p); return 0; }
#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() { char near *near *ptr1; char near *far *ptr2; char near *huge *ptr3; printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3)); return 0; }
/* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%s\n", argv[0]); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.