P
prashna
Hi Guru's,
Here are my questions...
1)Why does c allows an extra "," in array intialiser?Is there any
advantage of this?
ex: int arr[5]={1,2,3,4,5,};
^^Compiler does not give error for this!
2)How to determine the size of the array which is passes as a
parameter to the function?
ex :
void foo(int arr[])
{
/*I want determine the size of the array "arr" in this function.I
tried *using "sizeof" operator and realised it is not going to work
as "arr" will be *treated as pointer to an int!!!!!!*/
}
Thanks in advance
Here are my questions...
1)Why does c allows an extra "," in array intialiser?Is there any
advantage of this?
ex: int arr[5]={1,2,3,4,5,};
^^Compiler does not give error for this!
2)How to determine the size of the array which is passes as a
parameter to the function?
ex :
void foo(int arr[])
{
/*I want determine the size of the array "arr" in this function.I
tried *using "sizeof" operator and realised it is not going to work
as "arr" will be *treated as pointer to an int!!!!!!*/
}
Thanks in advance