int foo(int a)
What will be the output of the above code ignoring any compiler warnings and assuming sizeof(int) as 4 when run on a 64 bit machine?
Some good reference -
In C programming language, array parameters are treated as pointers .So here we are passing base address of array a through function foo().
So the expression sizeof(a) will become sizeof (int *) which results in 4 or 8 depending on machine 32 bit or 64 bit.
Here it is mentioned that on 64 bit machine so it will return 8.
I am also haiving same doubt
int a mean we have allocated 10 Bytes from memory may or may not be consecutive
but a how it give 0 ??