when u pass array as an argument to a function only the starting address is
passed .so sizeof(a) is address of pointer !

On Sat, Sep 3, 2011 at 6:22 PM, priya ramesh <love.for.programm...@gmail.com
> wrote:

> In any C program,
> int main(){
> char a[100];
> foo(a);
> printf("%d", sizeof(a));
> }
> foo(char *s){
> printf("%d", sizeof(a));
> }
>
> In main sizeof a is 100, in foo it is 4. why??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to