Ok, I have a function to check if a number is a palindrome (it is not completed yet) which calls a function called copystring()
.
If I have
putchar(*destination)
Within the copystring()
function loop, it outputs the destination string as it should.
However, the original string within the is_palindrome
function is not being edited. It remains blank. Why is this happening and how can I fix it?
int is_palindrome(int num)
{
char buffer[30];
char reversebuffer[30];
sprintf(buffer, "%d", num);
copystring(reversebuffer, buffer);
reversestring(reversebuffer, strlen(reversebuffer));
}
void copystring(char *destination, char *source)
{
while (*source){
*destination = *source;
++source;
++destination;
}
*destination = '\0';
}