C 面試題之i 面試題

2021-05-23 21:42:26 字數 921 閱讀 5604

//i++面試題1.cpp

//中國台灣某著名防毒軟體公司2023年10月面試題

int i=3,j=4;

i?i++:++j;

printf("%d  %d/n",i,j);

//a. 3  3  b. 4  4   c.3  4     d.4  3

//答案b

//i++面試題2.cpp

//中國某著名計算機金融軟公司2023年面試題

int x=1,j=2;

int k=i+++j;

cout//答案b

//(i++)+j

//i++面試題3.cpp

//x=x+1,x+=1,x++,哪個效率最高?為什麼?

//解析:

//x=x+1最低,因為它的執行過程如下:

//(1)讀取右x的位址。

//(2)x+1

//(3)讀取左x的位址

//(4)將右值傳給左邊的x(編譯器並不認為左右x的位址相同)

//i++面試題4.cpp

//what will be the output of the following c code?[中國台灣某著名cpu生產公司2023年面試題]

#include

#define product(x) (x*x)

int main()

//9 49

//product(i++)=i++*i++;

//i++面試題5.cpp

//中國某著名綜合軟體公司2023年面試題

//if there are "int a=5,b=3;", the valule of a and b are ?  and ?

//after execute "!a&&b++;".

//a. 5, 3    b.0,1      c.0,3   d.5,4

C 面試題之sizeof面試題

sizeof面試題1.cpp what is the output of the following code?美國某著名計算機軟硬體公司面試題 include include include using namespace std structa structb int main 解析 ss1是乙...

C語言面試題之華為面試題

1 區域性變數能否和全域性變數重名?答 能,區域性會遮蔽全域性。要用全域性變數,需要使用 區域性變數可以與全域性變數同名,在函式內引用這個變數時,會用到同名的區域性變數,而不會用到全域性變數。對於有些編譯器而言,在同乙個函式內可以定義多個同名的區域性變數,比如在兩個迴圈體內都定義乙個同名的區域性變數...

C 面試題之賦值語句面試題

賦值語句例題1 中國台灣某著名計算機硬體公司2005年12月面試題 what does the following program print?include using namespace std int main char s abc int i for i 0 i 3 i cout 10 10...