+ 2

Logic please ?

#include <iostream> #include <cstdio> using namespace std; int main() { int x = 25; printf("%d ", printf("%d ", x)); return 0; } Output 25 3 Can anyone please explain me ?

11th Dec 2016, 4:37 AM
Vipul Walia
Vipul Walia - avatar
2 Answers
+ 2
On success,printf return the total number of characters written. your code print x then print what the inner printf returned.
11th Dec 2016, 5:11 AM
Ali Talebi
Ali Talebi - avatar
+ 1
Thank You so much for help and let me the knowledge logic behind it.
11th Dec 2016, 5:40 AM
Vipul Walia
Vipul Walia - avatar