typedef struct error{int warning, error, exception;}error;
main()
{
error g1;
g1.error =1;
printf("%d",g1.error);
}
Answer / susie
Answer :
1
Explanation
The three usages of name errors can be distinguishable
by the compiler at any instance, so valid (they are in
different namespaces).
Typedef struct error{int warning, error, exception;}error;
This error can be used only by preceding the error by struct
kayword as in:
struct error someError;
typedef struct error{int warning, error, exception;}error;
This can be used only after . (dot) or -> (arrow) operator
preceded by the variable name as in :
g1.error =1;
printf("%d",g1.error);
typedef struct error{int warning, error, exception;}error;
This can be used to define variables without using the
preceding struct keyword as in:
error g1;
Since the compiler can perfectly distinguish between these
three usages, it is perfectly legal and valid.
Note
This code is given here to just explain the concept
behind. In real programming don’t use such overloading of
names. It reduces the readability of the code. Possible
doesn’t mean that we should use it!
Is This Answer Correct ? | 2 Yes | 0 No |
main() { int i = 3; for (;i++=0;) printf(“%d”,i); }
how can u draw a rectangle in C
53 Answers Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,
void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above
/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }
What is the hidden bug with the following statement? assert(val++ != 0);
why the range of an unsigned integer is double almost than the signed integer.
How we print the table of 2 using for loop in c programing?
WAP to display 1,2,3,4,5........N
write a program to find out roots of quadratic equation "x=-b+-(b^2-4ac0^-1/2/2a"
#define a 10 int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } void foo() { #undef a #define a 50 }
write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .