What is the output of this? Void main(){ char a[10]="walk"; printf(%d,printf(a)); getch();} | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output of this? Void main(){ char a[10]="walk"; printf(%d,printf(a)); getch();}

18th Mar 2019, 4:06 AM
Archana
2 Answers
+ 4
Since printf() returns the total number of printed characters, and variable a stores "walk", the final output would be walk4 Remember that void return type for main is not standard. Many compilers will not accept it. Instead, do: #include <stdio.h> int main() { char a[10] = "walk"; printf("%d", printf(a)); }
18th Mar 2019, 4:35 AM
Fermi
Fermi - avatar
+ 6
Code Playground has the answer.
18th Mar 2019, 4:10 AM
Diego
Diego - avatar