C学习笔记(二)-理论
本博客用来记录理论易错题及一些重点概念。
如存在问题,欢迎指出。
理论选择易错题
-
What is the output of this C code?
#include <stdio.h> int main(){ int i = j =10; printf("%d\n", j++); return 0; }
Ans: Compilation error: Use of undeclared identifier ‘j’
-
What is the output of this C code?
#include <stdio.h> int main(){ int i =0, j =0; if(i &&(j = i +10)); //!!! printf(“%d”,j); return 0; }
Output: 0
-
What is the output of this C code?
#include <stdio.h> int main(){ float x =0.1; printf("%d, ", x); printf("%f", x); return 0; }
Ans: Junk value, 0.100000
-
What is the output of this C code?
#include <stdio.h> int main(){ float x = 10; if (x < 5) printf("x < 5"); else if (x > 10) printf("x > 10"); else printf("Unknown"); return 0; }
Ans: Unknown
-
What is the output of the code given below?
#include <stdio.h> int k = 0; void display(){ printf("%d ",k++); //main里的k未传入 } int main(){ int i; static int k = 10; for (i = 0; i < 5; i++) display (); printf("\n"); return 0; }
Ans: 0 1 2 3 4
-
What is the output of this C code?
#include <stdio.h> int main(){ extern int x; int x = 0; printf("%d",x); return 0; } int x = 100;
Ans: compile-time error: Non-extern declaration of ‘x’ follows extern declaration
-
Computer can execute the code in ____.
Ans: machine language -
___ translates high-level language program into machine language program.
Ans: A compiler(编译程序)