// Enter code here
#include <stdio.h>
int main()
{
char rivers[100];
int count;
scanf("%s",rivers);
while(rivers[count] != 0)
{
count++;
}
for(;count>=0;count--)
printf("%s",rivers[count]);
return 0;
}
When I receive a string and try to print it out in reverse order leaving the position of null, but if I run it, the error window appears with null output, so what's wrong?
array
Once the count is not initialized, it is %c
instead of %s
when outputting to . It's an array of characters.
© 2024 OneMinuteCode. All rights reserved.