Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C Programming
»
Structures, Unions, Enums
Point out the error in the program? struct emp { int ecode; struct emp *e; };
Error: in structure declaration
Linker Error
No Error
None of above
Correct Answer:
No Error
Explanation:
This type of declaration is called as self-referential structure. Here
*e
is pointer to a
struct emp
.
← Previous Question
Next Question→
More Questions from
Structures, Unions, Enums
Point out the error in the program? #include
int main() { struct a { float category:5; char scheme:4; }; printf("size=%d", sizeof(struct a)); return 0; }
Point out the error in the program? #include
#include
void modify(struct emp*); struct emp { char name[20]; int age; }; int main() { struct emp e = {"Sanjay", 35}; modify(&e); printf("%s %d", e.name, e.age); return 0; } void modify(struct emp *p) { p ->age=p->age+2; }
Point out the error in the program in 16-bit platform? #include
int main() { struct bits { int i:40; }bit; printf("%d\n", sizeof(bit)); return 0; }
Nested unions are allowed
A structure can be nested inside another structure.
Union elements can be of different sizes.
The '->' operator can be used to access structures elements using a pointer to a structure variable only
Which of the following statement is True?
The '.' operator can be used access structure elements using a structure variable.
A union cannot be nested in a structure
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments