#include <stdio.h>
int main() {
int x=5;
printf("%d", printf("%d %d",x,x));
}
How is the output 5 53
can someone explain ? I tried myself and I think the answer should be 5 5 2
The return value of printf
is the
number of characters transmitted to the output stream or negative value if an output error or an encoding error (for string and character conversion specifiers) occurred
(from here , emphasis mine) and "5 5" are three characters (namely "five space five"). So the last number printed is 3.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.