OK, enough winners for this problem 😉
By far the most viewed topic in this blog!
and the most solved problem
I really have enjoyed noticing how every one tried to reduce it to 1 line .. to the extend that we don’t have a Second Place !
First Place 1 line (in order of who sent first)
- Alaa Shaker
- Mohammad Diab
- Anonymous ! .. he didn’t leave a second name so i can’t really tell which Anonymous is he 😀 .. please send a name man .. a nickname is also fine 😀
- Amr Saqr
- Mohamed Samy
- Mohamed Hesham – Filipino
- Mohamed Abdelghani
- Mohamed Abd-Elmone’m
- Tasniem Seliem
now to the solution 😀
while( *dest++ = *src++ );
we use a very unique feature .. a very dangerous feature .. its .. well i don’t know what do they call it 😀
its when an arithmetic expression can be converted implicitly to a boolean expression .. so its “implicit conversion” i think (A)
i am sure that every one of us has spent hours and hours in debugging some code that doesn’t work as it should .. only to find out at the end that he left out some “=”..
if( x = 5 ) //instead of if( x == 5 )
right ? 😛
of course for old programmers its usually not an issue .. but for new comers .. well i think they still feel the sour of it 😀
but i think now that you have seen that feature being helpful sometimes .. you will never fall in that trap again.