ExamVeda
Login
Home
This question belongs to C Program C Fundamentals
C Fundamentals
?

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:

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.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.