linux - A classic question about printf in C language
学习ing
学习ing 2017-07-03 11:41:39
0
1
1359

The following program, what is the output result?

#include  int main() { int i = 43; printf("%d\n",printf("%d",printf("%d",i))); return 0; }

Original series source: Several classic interview questions in C language under Linux

学习ing
学习ing

reply all (1)
phpcn_u1582

The answer is 43 2 1
Explanation: printf("%d", i) has a return value and returns the number of outputs
The above code can be converted to:

int i = 43; a = printf("%d", i) # output: 43 b = printf("%d", a) # output: 2 printf("%d", b) # output: 1
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!