C Programming > Structures
UNIONS AND ENUMERATIONS MCQs
Total Questions : 72
Page 1 of 8 pagesA compiler may leave holes in structures by padding the first char in the structure with another
byte just to ensures that the integer that follows is stored at an location. Also, there might be
2extra bytes after the integer to ensure that the long integer is stored at an address, which is
multiple of 4. Such alignment is done by machines to improve the efficiency of accessing values.
A structure pointing to itself is called self-referential structures.
No answer description available for this question.
No answer description available for this question.
No answer description available for this question.
No answer description available for this question.
No answer description available for this question.
No answer description available for this question.
You can write a function of your own to map an enumeration constant to a string.
Will the following code work?
#include<stdio.h>
#include<malloc.h>
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;
}
The program allocates space for the structure with the size adjusted so that the
name field can hold the requested name.
Recent Questions
Q. _________ Is The Connective Tissue Beneath the Sk....
Q. Positive Integers Indicated By X And Y Satisfy 3 1/x * Y 2/....
Q. The Knocking Tendency In Compression Ignition Engines For A ....
Q. In __________verb The Action Passes From The Subject An Obje....
Q. Pre-cooling Is Required Before Passing The Vapour To The Con....
Q. Ctrl + I Is Used To
Q. Q. Consider The Following Items: Prison Trade And Co....
Q. Who Is Paul A. Volcker ?
Q. If H₁ = Inner Film Co-efficient And /h₂ = Outer Film Co-....
Q. Which One Is True About Bacteria
Q. Who Was The 1st President Of BCCI ( Board Of Control For Cri....
Q. A Combinational Logic Circuit Which Generates Particular Bin....
Q. Assertion A : To Estimate The Rainfall Over A Catchment, The....
Q. A....
Q. The Department Of Atomic Energy Was Established In
Q. In Figure, The Current I
Q. A Bar Of Square Section Of Area A² Is Held Such That It....
Q. Vane Anemometer
Q. When Low Carbon Steel Is Heated Up To Upper Critical Tempera....
Q. Metacentric Height Is Given As The Distance Between