What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
char *p = "World";
int i = 2;
switch (p[i]) {
case 'W' :i++; break ;
case 'o' :i += 2; break ;
case 'r' :i += 3; break ;
case '1' :i += 4; break ;
case 'd' :i += 5; break ;
default :i += 4;
}
printf("%d", i);
return 0;
}
-
Choose the right answer:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
int i = 1;
for(;i > 128;i *= 2);
printf("%d", i) ;
return 0;
}
-
Choose the right answer:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
char *t = "abcdefgh";
char *p = t + 2;
int i;
p++;
p++;
printf("%d ", p[2] - p[-1]);
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
int f1(int n) {
return n = n * n;
}
int f2(int n) {
return n = f1(n) * f1(n);
}
int main(int argc, char ** argv) {
printf ("%d \n", f2(1));
return 0;
}
-
Select the correct answer:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
float f = 1e1 + 2e0 + 3e-1;
printf("%f ",f);
return 0;
}
Choose the right answer:
Assume that we can open a file called "file1".
What happens when you try to compile and run the following program?
#include
int main (void) {
FILE *f;
int i;
f = fopen("file1","wb");
fputs("545454",f);
fclose (f);
f = fopen("file1","rt");
fscanf(f,"%d ", &i);
fclose (f) ;
printf("%d",i);
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
enum { A, B, C, D, E, F };
#include
int main (int argc, char *argv[]) {
printf ("%d", B + D + F);
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#define ALPHA 0
#define BETA ALPHA-1
#define GAMMA 1
#define dELTA ALPHA-BETA-GAMMA
#include
int main(int argc, char *argv[]) {
printf ("%d", DELTA);
return 0;
Choose the right answer:
What is the meaning of the following declaration?
float ** p;
Choose the right answer:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
int i = 'A' - 'B';
int j = 'b' - 'a';
printf("%d",i / j);
return 0;
}
Choose the right answer: