I am supposed to write a function that prints a sequence but in reverse order. It must return its parameter. The string should not be modified. I am only allowed to use the putchar function and while/if loops.
the function prototype is
char *revprint(char *strng)
so it should turn Hello into olleH
This is my code. Where am I wrong?
char *rev_print(char *strng)
{
int i = 0;
while (*strng[i] = '\0');
{
i++;
}
while (*strng[i] <= 0)
{
putchar(*strng[i])
i--;
}
return (*strng)
}