D
Debajyoti Sarma
How to implement sizeof operator in C ?
cases
1. int i=0; sizeof(i)=4 ...i.e size of variables
2. sizeof(int)=4 ...i.e size of datatypes
3. struct t
{
int a;
char c;
}p;
sizeof(p)=5 ....i.e it should work for user
define data types
sizeof(t)=5
Function is more preferable than macro.
cases
1. int i=0; sizeof(i)=4 ...i.e size of variables
2. sizeof(int)=4 ...i.e size of datatypes
3. struct t
{
int a;
char c;
}p;
sizeof(p)=5 ....i.e it should work for user
define data types
sizeof(t)=5
Function is more preferable than macro.