951 views
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?

2 Answers

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.

0 votes
0 votes
Output would be -11,34 because in c if we write const c..this means ci by default int...

Related questions

3 votes
3 votes
1 answer
1
Hira Thakur asked Jun 14, 2017
730 views
The output of below code is_______________. int main() { int i = 120; int *a = &i; foo(&a); printf("%d ", *a); printf("%d ", *a); } void foo(int const a) { int j = 210; ...
1 votes
1 votes
2 answers
2
0 votes
0 votes
1 answer
3
0 votes
0 votes
2 answers
4
Anil Khatri asked Sep 8, 2016
1,831 views
What will be the output of the program?#include<stdio.h>int main(){ char c=48; int i, mask=01; for(i=1; i<=5; i++) { printf("%c", c|mask); mask ...