Recent questions tagged programming-in-c

3 3 votes
1 1 answer
252
252 views
Assume the following $C$ code is inside the main function and there are no syntax or runtime errors:int A[] = {3, 1, 4, 9, 7, 2, 5, 8}; int *p = &(A[3]) - 2; p += *p; pri...
1 1 vote
1 1 answer
207
207 views
Consider the following C code. Where x and y are unknown integers and have been initialized to values greater than 1.int i = 1, j = 0; while (i < y) { i = i + 1; if (i ==...
0 0 votes
1 1 answer
190
190 views
Consider the following C code:int i = 0; int j = 0; char *s = "abcde"; while (s[i] != '\0') { j = j + s[i] - 'a'; i = i + 1; } printf("%d %d\n", i, j); What will the prog...
2 2 votes
1 1 answer
240
240 views
What would be displayed if the following code fragment was executed?int n = 4; int s = -n; while (n 1) { n = n - s; s = s + n; s++; n ; } printf("%d", s);5812None of the...
2 2 votes
1 1 answer
467
467 views
The default storage class for global variables in the C language is –StaticAutoExternNone of these
2 2 votes
1 1 answer
195
195 views
What should be the output of the following C program?#include <stdio.h int main(void) { int my_array[] = {1, 5, 10, 15}; int *an_array[] = {&my_array , &my_array[0]}; int...