Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C Programming
»
Structures, Unions, Enums
Can a structure can point to itself?
Yes
Correct Answer:
Yes
Explanation:
A structure pointing to itself is called self-referential structures.
← Previous Question
Next Question→
More Questions from
Structures, Unions, Enums
If the following structure is written to a file using fwrite(), can fread() read it back successfully? struct emp { char *n; int age; }; struct emp e={"CuriousTab", 15}; FILE *fp; fwrite(&e, sizeof(e), 1, fp);
Is there easy way to print enumeration values symbolically?
The elements of union are always accessed using & operator
Is it necessary that the size of all elements in a union should be same?
By default structure variable will be of auto storage class
Will the following declaration work? typedef struct s { int a; float b; }s;
Will the following code work? #include
#include
struct emp { int len; char name[1]; }; int main() { char newname[] = "Rahul"; struct emp *p = (struct emp *) malloc(sizeof(struct emp) -1 + strlen(newname)+1); p->len = strlen(newname); strcpy(p -> name, newname); printf("%d %s\n", p->len, p->name); return 0; }
A pointer union CANNOT be created
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments