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 |
#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }
Who could write how to find a prime number in dynamic array?
What are the following notations of defining functions known as? i. int abc(int a,float b) { /* some code */ } ii. int abc(a,b) int a; float b; { /* some code*/ }
main() { int a[10]; printf("%d",*a+1-*a+3); }
hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?
# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
Sorting entire link list using selection sort and insertion sort and calculating their time complexity
1 Answers Infosys, Microsoft, NetApp,
void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }
int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }