1,745 views
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?

4 Answers

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.

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

Related questions

3 3 votes
1 answers 1 answer
1.7k
1.7k views
Hira Thakur asked Jun 14, 2017
1,674 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; ...
5 5 votes
2 2 answers
736
736 views
amar100 asked Nov 3, 2024
736 views
#include <stdio.h int main() {short a[3] = {3, 6, 9, 12, 15, 18};printf("%d\n", *(a + 1) );return 0; }The output is 15. How is the output is 15? , In my thinking it must...
1 1 vote
2 2 answers
2.4k
2.4k views
bharti asked Aug 23, 2017
2,372 views
#include "stdio.h" int * gPtr;int main(){int * lPtr = NULL;if(gPtr == lPtr){printf("Equal!");}else{printf("Not Equal");}return 0;}what will be the outpout :A. it will alw...
0 0 votes
1 1 answer
934
934 views
Anil Khatri asked Sep 8, 2016
934 views
What will be the output of the program assuming that the array begins at the location 1002 and size of an integer is 4 bytes?#include<stdio.h>int main(){ int a[3][4] =...