I read that. But still it should not be compiled as per the standard.

The latest GNU C/C++ compiler correctly fails to compile this

--------------------------------------------------
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14


On Sun, Jun 13, 2010 at 10:44 AM, divya jain <sweetdivya....@gmail.com>wrote:

> sorry for the silly question i got rhe point..
>
> @ rohit
> compiler is doing rite..read mahesh's explanatn
>
> On 13 June 2010 08:27, Rohit Saraf <rohit.kumar.sa...@gmail.com> wrote:
>
>> This is very bad. Change your compiler if it compiles this stuff :)
>>
>> btw.. which compiler is it?
>>
>> Output for me :
>> ro...@rohit-laptop:~/dump$ gcc c.c
>> c.c: In function ‘main’:
>> c.c:14: error: incompatible types when assigning to type ‘char[20]’ from
>> type ‘char *’
>> c.c:15: error: incompatible types when assigning to type ‘char[20]’ from
>> type ‘char *’
>>
>> --------------------------------------------------
>> Rohit Saraf
>> Second Year Undergraduate,
>> Dept. of Computer Science and Engineering
>> IIT Bombay
>> http://www.cse.iitb.ac.in/~rohitfeb14<http://www.cse.iitb.ac.in/%7Erohitfeb14>
>>
>>
>>
>> On Sun, Jun 13, 2010 at 8:13 AM, Mahesh_JNU <mahesh.jnumc...@gmail.com>wrote:
>>
>>> Well
>>>
>>> As we know for copying the string we can can copy it as a simple variable
>>> as in case of address copying.
>>> when u r doing names[3] = names[4] , it means u r trying to copy it
>>> directly
>>> bt in the case of  char *names[] , as it is the array of pointers so u
>>> can copy the address from one pointer to another pointer....
>>>
>>> Thanks
>>>
>>>
>>> On Sat, Jun 12, 2010 at 9:12 PM, divya <sweetdivya....@gmail.com> wrote:
>>>
>>>> #include<stdio.h>
>>>>
>>>> int main()
>>>> { char names[][20]={
>>>> "roshni",
>>>> "manish",
>>>> "sona",
>>>> "baiju",
>>>> "ritu"
>>>> };
>>>> int i;
>>>> char *t;
>>>> t=names[3];
>>>> names[3]=names[4];
>>>> names[4]=t;
>>>> for(i=0;i<=4;i++)
>>>> printf("%s",names[i]);
>>>> printf("\n");
>>>> return 0;
>>>> }
>>>>
>>>> here i get l value required as error and if i replace char names[][2]
>>>> with char *names[].. then there is no error nd the names[3] n names[4]
>>>> interchange
>>>> plzzzz explain why???
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algoge...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>>
>>>
>>>
>>> --
>>>   Mahesh Giri
>>>  MCA Final Sem
>>> JNU, New Delhi
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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