Page 1 of 1

Question 1: What will be the output of the following C code? void main(void) { int *a, S = 0, n = 3, i; a = (int*)malloc

Posted: Thu May 26, 2022 9:39 am
by answerhappygod
Question 1 What Will Be The Output Of The Following C Code Void Main Void Int A S 0 N 3 I A Int Malloc 1
Question 1 What Will Be The Output Of The Following C Code Void Main Void Int A S 0 N 3 I A Int Malloc 1 (91.47 KiB) Viewed 16 times
Question 1: What will be the output of the following C code? void main(void) { int *a, S = 0, n = 3, i; a = (int*)malloc(n*sizeof(int)); for(i=0; i<n; i++) *(a + i) = S + i; S = *(a + 2); printf("%d ", S); } ANSWER:............ Question 3: What will be the output of the following C code? void main(void) { int *a, i, S = 0, n = 4; a = (int*) malloc(n*sizeof(int)); for(i=0; i<n; i++) *(a+i) = 1; S = *a + 1 + *(a + 1); printf("%d", S); Question 2: What will be the output of the following C code? void main(void) { int a[4] =(4,3,2,1); int b[4] = {0}; int S, i; for (i = 0; i < 4; i++) if (a%2 == 0) b = a; S = b[1]; printf("%d ", S); } ANSWER:.. Question 4: What will be the output of the following C code? void main(void) { int *a,b[3] = {3}; int S = 1; a = b; S = *(a + 2) + *a; printf("%d", S); ANSWER:..