In this c programming example we will learn how to reverese a line string
#include <stdio.h> int stringLength(char s[]) { while(s[i]!='\0') return i; void string_reverse(char st[]) { j = len = stringLength(st) - 1; while(i < j) { int main (void) {
for(i = n-1; i >= 0; --i) { for(j = 0; i >= 0 && line[i] != ' '; --i,++j) temp[j] = '\0'; string_reverse(temp); printf("Original - %s\n", line); return 0; |
Input String - C program to reverse line string
Reversed String - string line reverse to program C