Sizeof format zu or u
- It is a compile time unary operator which can be used to compute the size of its operand.
- The result of sizeof is of unsigned integral type which is usually denoted by size_t.
- sizeof can be applied to any data-type, including primitive types such as integer and floating-point types, pointer types, or compound datatypes such as Structure, union etc.
- It simply return amount of memory is allocated to that data types.
Program:
/* sizeof by Velraj.K
Check : http://velrajcoding.blogspot.in
*/
#include <stdio.h>
#define STRNAME "Velraj"
int main()
{
printf("Vel size = %zu int= %zu float = %zu double= %zu 0 = %zu NULL = %zu \"\" = %zu int * = %zu\n",
sizeof("vel"), sizeof(int), sizeof(float), sizeof(double), sizeof(0), sizeof(NULL), sizeof(""), sizeof(int *));
return 0;
}
Output:
velrajk/sample$ ./a.out
Vel size = 4 int= 4 float = 4 double= 8 0 = 4 NULL = 8 "" = 1 int * = 8
No comments:
Post a Comment