answersLogoWhite

0


Best Answer

You cannot overload the sizeof() operator because that could introduce uncertainty in its evaluation. The sizeof() operator must always produce an accurate and logically predictable result, thus all user-intervention is completely forbidden.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

According to the standard it is an operator.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is sizeof an operator or function why?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why you call sizeof is a operator not a function in c language?

If sizeof were a function, the following code would work (you can try with any other function):printf ("Function sizeof is located at %p", sizeof);On the other hand, the following code wouldn't work, as functions don't accept a type as parameter:size_t intsize= sizeof (int);


Explain the role of sizeof operator in java?

There is no sizeOf() operator in Java.


Which operator works like sizeof operator in Java?

Java does not have the sizeOf() operator or any operator that gives an equivalent result.


Difference between sizeof and strlen?

The sizeof operator returns the total size, in bytes, of the given operand, whereas the strlen function returns the number of characters in the argument up to but not including the first null-terminator.Consider a character buffer allocated 50 bytes to which you assign the string "Hello world". The sizeof operator will return 50, but the strlen function returns 11.


Sizeof operator to determine the memory occupied by structure variables and pointers?

C and C++ both include the built-in sizeof() operator to do just that.


What does of size of operator do?

The sizeof() operator returns the number of bytes allocated to the operand.


What is a sizeof function in C programming?

Sizeof is an example.


Why java does not use sizeof operator?

Sizeof() is not needed because Java basic types sizes are fixed


Size of operator?

The sizeof() operator returns the number of bytes required to represent its argument.


What is size of operator in c language?

it is used to know the memory size of variable of data type. Ex: float a; printf ("sizeof (a)= %d\n", sizeof (a)); or: printf ("sizeof (float)= %d\n", sizeof (float));


How can you can create a new operator through operator overloading?

You cannot create any new operators in C++. You can only overload the existing ones (although some, such as sizeof, new and delete cannot be overloaded). The only way to create a new operator is to implement it as a standard function with a named identifier. For instance, sqrt() is the standard library function that provides the square root operator, for which no real operator exists.


What is the use of 'size of' in c programming?

The sizeof operator is used to determine the length of its operand (in bytes). The operand must be a type or an object of a type (a variable). The operator is a constant expression and therefore executes at compile time. As such there is no runtime overhead in repeated use of the sizeof operator.