+ 2
HELP..what is the size of int?
if we have an array : int arr[6]; then how many bytes does each element take inside the memory????
3 Answers
+ 7
The size of integer type depends on several factors, size of an int in a 32bit machine differs with 64bit machine, plus compiler also plays a role on the size. The most practical way is to use the sizeof function passing the type name for argument e.g. sizeof(int), this will return number of bytes needed to allocate a variable of the said type. You can use the function for most common types available, including user defined ones.
Hth, cmiiw
+ 4
You're welcome @RiGeL, glad to help : )
+ 3
@Ipang thank you alot