2 2 votes What will be the output of the program? #include<stdio.h> int main() { const c = -11; const int d = 34; printf("%d, %d\n", c, d); return 0; } A. Error B. -11, 34 C. 11, 34 D. None of these is it const c = -11; correct definition? Programming in C const + – Anil Khatri 1.7k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
1 1 vote http://stackoverflow.com/questions/11064292/declaring-variables-without-any-data-type-in-c A variable declared without an explicit type name is assumed to be of type int. It's a valid C program and the answer is B. air1 answered Sep 9, 2016 air1 comment Share Follow See all 4 Comments 4 4 Comments reply ManojK commented Sep 9, 2016 reply Follow flag @Arjun Sir verify this. 0 0 replyShare air1 commented Sep 9, 2016 reply Follow flag A variable declared without an explicit type name is assumed to be of type int. This was quoted from the official language specification. http://ideone.com/6e8t2k 0 0 replyShare Anil Khatri commented Sep 9, 2016 reply Follow flag is it always be "int" ? like if instead of printf("%d, %d\n", c, d); if we hve printf("%c, %d\n", c, d); then i think it will give error becoz c=-11 if it is c=11 then it print ASCII value of 11 correct? 0 0 replyShare air1 commented Sep 9, 2016 reply Follow flag -11 will be converted to signed char. So it will become 245 and the character corresponding to ASCII value 245 will be printed. http://www.asciitable.com/ http://stackoverflow.com/questions/13161199/ascii-table-negative-value 1 1 replyShare Please log in or register to add a comment.
0 0 votes Output would be -11,34 because in c if we write const c..this means ci by default int... sandeepjkh answered Aug 29, 2017 sandeepjkh comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes const c = -11; is not a correct definition in standard C; you must specify a type explicitly. nirmal_aravind answered Dec 11, 2025 nirmal_aravind comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes B is correct Gudiya_Vishwakarma answered Dec 12, 2025 Gudiya_Vishwakarma comment Share Follow 0 reply Please log in or register to add a comment.