Reverse String in C
Tagged:
Below is a C program that will reverse (input) text.
#include<stdio.h>
int main(){
int length = 0;
char name[30];
printf("enter your name: ");
scanf("%[^\n]", name);
//determine the length of the string
while(name[length] != '\0')
length ++;
while(length >= 0){
printf("%c", name[length]);
length --;
}
return 0;
}
output:
![]()

Post new comment