[glug-t] Re: Hacking in C

This can be solved:

char *p = str1;
while( *p++ = *str2++ );
return str1;

Usually this is put inside a function, so the changed value of str2
is within the function call only.
Of course, all this is assuming that str1 is pointing to some valid
memory, and is adequate...

Aashish


--- palaniappan chellappan <palam_analog@xxxxxxxxxxx> wrote:
> Here is one of the solution, 
> 
> while( *str1++ = *str2++ );
> 
> The only problem in this solution is str1 and str2
> won't point to the string after copying it.
> 
> 
> --- Vijay Kumar <vijaykumar@xxxxxxxxxxxx> wrote:
> > Here is a simple task which is not trivial in C -
> > You have two char
> > pointers str1 and str2. str2 points to a string,
> > which has to be copied
> > to a buffer pointed to by str1. 
> > Regards,
> > Vijay
> 
> 
> 
>               
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Personals - Better first dates. More second dates. 
> http://personals.yahoo.com
> 
> ---------------------------------------------------------------
> To unsubscribe send a mail to glug_t-request@xxxxxxxxxxxxx with 
> 'unsubscribe' as subject.
> 
> Website: http://glugt.linuxisle.com
> 

"The mind is a figment of its own imagination"


                
__________________________________ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest
---------------------------------------------------------------
To unsubscribe send a mail to glug_t-request@xxxxxxxxxxxxx with 
'unsubscribe' as subject.

Website: http://glugt.linuxisle.com

Other related posts: