I'm trying to write a program that when given a string it prints it back whats.
here is my program.Note I'm a biginner in C.
When I run the above program on input:
I get as my result:
I do not want that
here is my program.Note I'm a biginner in C.
Code:
#include <stdio.h>
#include <string.h>
char input[];
main(){
//gets(input);
scanf("%s",input);
reverse(input);
}
void reverse(){
int length,i;
length = strlen(input);
char reverse[length];
for(i=0;i < length;i++){
reverse[i] = input[length - i - 1];
}
printf("%s\n",reverse);
}
Code:
thato
Code:
otaht&
Code:
&
Comment