Explain the output of this program. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Explain the output of this program.

#include<stdio.h> int main() { int n = printf("0"); printf("%d",n); } The output of this program is =01 EXAPLAIN HOW ?

6th Aug 2020, 7:43 PM
Riya Kumari
Riya Kumari - avatar
10 Answers
+ 7
See this example you will understood much better https://code.sololearn.com/ckQ5cwZvwzNo/?ref=app
7th Aug 2020, 3:41 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 7
Riya Kumari welcome mam
10th Aug 2020, 2:15 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 5
First printf will print 0 then in second printf u write %d to it will count total characters in first printf and total char is one right so it print 1. But if u will write like this Explain the output of this program. #include<stdio.h> int main() { int n = printf("riya"); printf("%d",n); } Then first printf will print riya then it will count total char and total chars are 4 so output will be riya4 hope u understood.
7th Aug 2020, 3:39 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
0 -> del printf 1-> números de caracteres del printf(uno caractere)
6th Aug 2020, 10:36 PM
Gabriel Caldeira Bicalho
Gabriel Caldeira Bicalho - avatar
7th Aug 2020, 5:40 AM
Riya Kumari
Riya Kumari - avatar
7th Aug 2020, 10:41 AM
Gabriel Caldeira Bicalho
Gabriel Caldeira Bicalho - avatar
+ 1
The output of the program is "01".if we were given the control string in printf as the variable declarations, we simply have to count the number of elements in the string, and that assigns to the variable..
8th Aug 2020, 9:26 AM
RuntimeERROR
RuntimeERROR - avatar
0
7th Aug 2020, 5:39 AM
Riya Kumari
Riya Kumari - avatar
7th Aug 2020, 5:40 AM
Riya Kumari
Riya Kumari - avatar
0
🐉🐉 thankx alot for the explanation
9th Aug 2020, 6:24 PM
Riya Kumari
Riya Kumari - avatar