1 votes 1 votes #include<stdio.h> int main() { int a = 10, b = 20, c = 30, d = 40; printf("%d%d%d",a, b, c); printf("%d%d%d", d); return 0; } What is the Output and when I run it I am getting some wierd answer. Please explain ? Programming in C programming-in-c undefined-behaviour output non-gate + – Prajwal Bhat asked Aug 19, 2016 Prajwal Bhat 1.1k views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply dd commented Aug 19, 2016 reply Follow Share show your o/p 0 votes 0 votes Prajwal Bhat commented Aug 19, 2016 reply Follow Share Compiler-DevCpp Compiler-Codechef Online why 2 different outputs and what do they mean, i understood first 4 integers 10203040 but after that why it is printing so? 0 votes 0 votes Kapil commented Aug 20, 2016 reply Follow Share It is printing garbage value , because, %d expects a integer value but since after printing d's value, there is no other integer to be printed. Now, since your syntax is right, it prints garbage value. 2 votes 2 votes Please log in or register to add a comment.
0 votes 0 votes It has to throw compile time error main () // there is no parathesis printf " " // printf syntax is not properly followed pC answered Aug 23, 2016 pC comment Share Follow See 1 comment See all 1 1 comment reply vijju532 commented Mar 20, 2018 reply Follow Share it should be printf("%d",d); 0 votes 0 votes Please log in or register to add a comment.