Your inner
while
-loop does not increment
i
,
for(i=0;i<len;i++)
{
while(src[i]!='\0')
dest[i]=src[i];
}
Change it to something like this;
for(i=0;i<len;i++)
{
dest[i]=src[i];
if (src[i] =='\0')
break;
}
Remember that you want to copy the last
'\0'
from
src
to
dest
or
dest
won't be properly zero-terminated.
Hope this helps,
Fredrik