MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
void is ____ data type.
A
primary
B
derived
C
user defined
D
none of above
Explanation: 

Detailed explanation-1: -The void data type has no values and no operations. It’s a data type that represents the lack of a data type. Many programming languages need a data type to define the lack of return value to indicate that nothing is being returned.

Detailed explanation-2: -The void data type always represents an empty set of values. The only object that can be declared with the type specifier void is a pointer. You cannot declare a variable of type void, but you can explicitly convert any expression to type void .

Detailed explanation-3: -Primary data types are also known as the fundamental data types because they are pre-defined or they already exist in the C language. All the other types of data types (derived and user-defined data types) are derived from these data types. Primary data types in C are of 4 types: int, char, float, and double.

Detailed explanation-4: -The void pointer in C is a pointer that is not associated with any data types. It points to some data location in the storage. This means it points to the address of variables. It is also called the general purpose pointer.

Detailed explanation-5: -A pointer of type void * represents the address of an object, but not its type. For example, a memory allocation function void *malloc( size t size); returns a pointer to void which can be casted to any data type.

There is 1 question to complete.