problem printing pointer
I have the following code:
Code:
#include <stdio.h> |
On the line in question, the value of dest is not the same as the value of ptr2.
Additionally, the value of ret, in the other commented puts will not be the same as ptr2. Think about it a bit - you've been incrementing dest - where does it point on the line in question? |
How do I return dest and make it work? I tried passing it like so:
Code:
return &dest[0]; I also tried return *(dest - (strlen(source))); but that didn't work either. |
You need to think about what your variables hold a bit more. You actually don't need to declare anything new, but need to make use of something you're not.
I suggest another glance through the K&R C. |
Code:
char *my_strcpy(char *dest, char *source) |
Quote:
|
All times are GMT -5. The time now is 02:50 AM. |