?
What is the purpose of the 'sizeof' operator in C?
Answer & Solution
Correct Answer:
Option
B
The purpose of the 'sizeof' operator in C is to determine the size of a data type or a variable in bytes. It is used to find out how much memory is allocated to a specific data type or an object in memory.
So, the correct answer is:
Option B: Determine size
Here's an example of how 'sizeof' operator is used in C:
In this example, 'sizeof(int)' will return the size (in bytes) of the 'int' data type, and it will be stored in the 'size' variable. It is a valuable operator when you need to work with memory allocation and management in C.
So, the correct answer is:
Option B: Determine size
Here's an example of how 'sizeof' operator is used in C:
int size = sizeof(int);printf("Size of int: %d\n", size);In this example, 'sizeof(int)' will return the size (in bytes) of the 'int' data type, and it will be stored in the 'size' variable. It is a valuable operator when you need to work with memory allocation and management in C.
Join the Discussion
Login to post a comment or share your explanation.
Login