SarkariBix
SarkariBix
Start typing & press "Enter" or "ESC" to close
  • Home
  • Jobs
  • Results
  • Current Affairs
  • GK
  • Online Test
  • HR Interview
  • BLOG

What will be the output of the program? #include #include union employee { char name; int age; float salary; }; const union employee e1; int main() { strcpy(e1.name, "K"); printf("%s %d %f", e1.name, e1.age, e1.sa

  • Home
  • Computer Science & Engineering
  • C Programming Questions and Answers
  • Const
  • Discuss - 742
1. 

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;
}

[A]. Error: RValue required
[B]. Error: cannot convert from 'const int *' to 'int *const'
[C]. Error: LValue required in strcpy
[D]. No error

Answer: Option D

Explanation:

The output will be (in 16-bit platform DOS):

K 75 0.000000

Workspace Report
Leave a Comment

Computer Science & Engineering :: C Programming Questions and Answers : More Exercises

  • Declarations and Initializations
  • Expressions
  • Functions
  • Pointers
  • Strings
  • Input / Output
  • Bitwise Operators
  • Const
  • Variable Number of Arguments
  • Library Functions
  • Control Instructions
  • Floating Point Issues
  • C Preprocessor
  • Arrays
  • Structures, Unions, Enums
  • Command Line Arguments
  • Typedef
  • Memory Allocation
  • Complicated Declarations

Questions & Answers

Aptitude Chemical Engineering Civil Engineering Computer Science & Engineering Current Affairs Data Interpretation Electrical & Electronics Engineering Electronics & Communication Engineering General Knowledge Logical Reasoning Mechanical Engineering Non Verbal Reasoning Verbal Ability Verbal Reasoning

Interviews

HR Interview

Jobs

Sarkari Jobs

Results

Rojgar ResultSarkari Result

Admission

Admission 2022

Admit Card

Admit Card 2022

Answer Key

Answer Key 2022
copyright
Privacy Policy
© 2022 SarkariBix. All Rights Reserved.

Report