What happens if you try to compile and run this program?
#include
int fun(int i) {
return i++;
}
int main (void) {
int i = 1;
i = fun(i);
printf("%d",i);
return 0;
}
Choose the correct answer:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
int main, Main, mAIN = 1;
Main = main = mAIN += 1;
printf ("%d", MaIn) ;
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:
Assume that ints are 32-bit wide.
What happens if you try to compile and run this program?
#include
typedef union {
int i;
int j;
int k;
} uni;
int main (int argc, char *argv[]) {
uni s;
s.i = 3;
s.j = 2;
s.k = 1;
printf("%d",s.k * (s.i - s.j));
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 i = 20 + 020 + 0x20;
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 = 20;
printf("%x", 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 main (int argc, char *argv[]) {
int i = 1;
for( ;; i/=2)
if(i)
break ;
printf("%d",i);
return 0;
}
Choose the right answer:
The program executes an infinite loop
Assume that ints and floats are 32-bit wide.
What happens if you try to compile and run this program?
#include
union uni {
float f, g;
int i, j;
};
int main (int argc, char *argv[]) {
union uni u;
printf ("%ld", sizeof (u) ) ;
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
#include
void fun (void) {
return 3.1415;
}
int main (int argc, char *argv[]) {
int i = fun(3.1415);
printf("%d",i);
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 is the meaning of the following declaration?
float ** p;
Choose the right answer: