1 votes 1 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 asked Sep 9, 2016 Anil Khatri 977 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes 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 See all 4 4 Comments reply ManojK commented Sep 9, 2016 reply Follow Share @Arjun Sir verify this. 0 votes 0 votes air1 commented Sep 9, 2016 reply Follow Share 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 votes 0 votes Anil Khatri commented Sep 9, 2016 reply Follow Share 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 votes 0 votes air1 commented Sep 9, 2016 reply Follow Share -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 votes 1 votes Please log in or register to add a comment.
0 votes 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 See all 0 reply Please log in or register to add a comment.