About C Interview Questions-structures:

This C interview questions-Structures page provides all the interview questions of Structures concept in C language including the size of the structure, processing structures, passing as parameters, returning structure variables and so on.

C Interview Questions-Structures

What is structure?
A used defined data type used to store more than one element of different types.

What is the difference between Array & Structure?
The array holds homogeneous elements where as Structure holds heterogeneous elements.

Can we define a Structure locally?
Structures can be defined locally(inside a function) or globally(Outside to all functions).
Local structures can be accessed only with in function in which it has defined.

How to allocate memory for a structure?
By declaring variables to structure type, we can allocate memory.

Can we initialize structure variable directly?
Yes, we can.
Using Assignment operator we can assign the values to structure elements (but in the defined order).

What is the use of gets() function?
gets() function reads the characters into String until we press return(enter) key.
Hence we can read multi-word strings like sentences.

Can we pass the structure as a parameter to function?
Yes, we can pass the structure as a parameter using its base address of structure block.

Can a function return structure?
yes, a function can returns address of structure as a return value.

Can we define a structure inside another structure?
it is called inner structure or nested structure.

How can we copy structure elements?
Structure elements can be copied directly by using assignment operator where as array elements
must be copied using loops.

How can we find the size of structure type?
using sizeof() function we can find out the size of user-defined data type also.

Why is structure called user-defined data type?
Because we are defining structure variables with the collection of other data types.

What is Accessor?
dot(.) operator is called Accessor. It is used to access structure elements.

How to process the elements of Structure?
Using dot operator in the application only we can read, display and process the elements of

>C Language Interview Questions on Strings<

Share this