C Programming - Const - Discussion
Discussion Forum : Const - Find Output of Program (Q.No. 2)
2.
What will be the output of the program?
#include<stdio.h>
#include<stdlib.h>
union employee
{
char name[15];
int age;
float salary;
};
const union employee e1;
int main()
{
strcpy(e1.name, "K");
printf("%s %d %f", e1.name, e1.age, e1.salary);
return 0;
}
Answer: Option
Explanation:
The output will be (in 16-bit platform DOS):
K 75 0.000000
Discussion:
28 comments Page 3 of 3.
Tejaswi said:
1 decade ago
Const is used how can we change the values?
Anonymous said:
1 decade ago
What is the significance of 'const' here?
Rishabh said:
1 decade ago
How can 75 be the value of e1.age ?
Anurag said:
1 decade ago
What is the use of const here?
Dinesh Prajapat said:
8 years ago
Output is K 0 0.000000.
Ajay said:
1 decade ago
Please explain in detail.
Jyothi said:
3 years ago
Please explain in detail.
Rakesh said:
1 decade ago
Please explain in detail.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers