C Programming - Structures, Unions, Enums - Discussion
Discussion Forum : Structures, Unions, Enums - Find Output of Program (Q.No. 8)
8.
What will be the output of the program in Turbo C (under DOS)?
#include<stdio.h>
int main()
{
struct emp
{
char *n;
int age;
};
struct emp e1 = {"Dravid", 23};
struct emp e2 = e1;
strupr(e2.n);
printf("%s\n", e1.n);
return 0;
}
Discussion:
60 comments Page 5 of 6.
Ratan said:
1 decade ago
The program has error since no <string.h> header file is included and string functions are being used.
Deepak said:
7 years ago
I have one doubt here, using *n so in the printf statement we need write a1->n, but here writing a1.
Kishore said:
1 decade ago
String functions are not supported in C. So its an error.
Undefined reference to 'main'.
Undefined reference to 'main'.
Raju said:
9 years ago
My GCC compiler gets closed after running this program. Why its happens, anyone helps me.
Anmol said:
1 decade ago
main(){
int x,y;
x=10;
y=x;
y=20;
printf("%d\t%d",x,y);
}
output= 10 20
int x,y;
x=10;
y=x;
y=20;
printf("%d\t%d",x,y);
}
output= 10 20
Mohd Saquib said:
8 years ago
As on compiling on GCC, no output. I got a Runtime error. Why? Please tell me.
Teju said:
1 decade ago
Why the output has printed in uppercase?? why it is not in lowercase?
Pradeep shukla said:
10 years ago
Error in GCC compiler ----> undefined reference to 'strupr'.
Shubhankar said:
1 decade ago
It is the difference between deep copy and shallow copy.
Rahul said:
1 decade ago
Is it possible to assign object of structure in C?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers