size of operater - is used to print the size in byte of your data types such as(int, char, float, double etc.) depend upon your different types of data types. and compilers
EXAMPLES
#include
#include
int main()
{
int i;
char ch;
float f;
double d;
long double l;
printf("\nsize of integer is %d byte",sizeof(i));
printf("\nsize of character is %d byte",sizeof(ch));
printf("\nsize of float is %d byte",sizeof(f));
printf("\nsize of double is %d byte",sizeof(d));
printf("\nsize of long is %d byte",sizeof(l));
getch();
}
Made by (ARUN KUMAR RAI).
C and C++ both include the built-in sizeof() operator to do just that.
There is no sizeOf() operator in Java.
Java does not have the sizeOf() operator or any operator that gives an equivalent result.
unary + is the only dummy operator in c,...
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));
The only "special" operators in C++ are those that cannot be overloaded. That is; the dot member operator (.), pointer to member operator (.*), ternary conditional operator (:?), scope resolution operator (::), sizeof() and typeof().
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.
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.
Yes. The array name is a reference to the array, so you can use sizeof (name) / sizeof (name[0]) to determine the number of elements. Note that sizeof (name) alone gives the length of the array in bytes.
1. Member-of operator (.) 2. Pointer-to-member-of operator (.*) 3. Ternary condition operator (?:) 4. Scope resolution operator (::) 5. sizeof operator 6. typeid operator
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);
The sizeof() operator returns the number of bytes allocated to the operand.