As declaration of a[100] is defined in main function so main function print
100 , but foo() only know a pointer to a char data type that is why it print
4 in function foo()

correct me if i am wrong!

On Sat, Sep 3, 2011 at 6:52 PM, UTKARSH SRIVASTAV
<[email protected]>wrote:

> char  *p,char [] are both same they  both have size 4
>
>
> On Sat, Sep 3, 2011 at 6:18 AM, himanshu kansal <
> [email protected]> wrote:
>
>> array is always given a special treatment.......its nt a constant
>> ptr....its an array means 100 bytes r resrvd for it....
>> for this i think u mst go thru pointers in c and ritchi books.....
>>
>>
>> On Sat, Sep 3, 2011 at 6:41 PM, priya ramesh <
>> [email protected]> wrote:
>>
>>> foo(char []s){
>>> printf("%d", sizeof(s));
>>> }
>>>
>>> even now it prints 4.
>>> My point is s pointer in foo and a is also a constant pointer in main. (a
>>> is passed to foo)
>>> However, in main a is treated as an rvalue and in s the same pointer is
>>> an lvalue. why??
>>>
>>> Someone plz reply. It's urgent
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>>
>>        Regards
>>  Himanshu Kansal
>>    Msc Comp. sc.
>> (University of Delhi)
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> *UTKARSH SRIVASTAV
> CSE-3
> B-Tech 3rd Year
> @MNNIT ALLAHABAD*
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to