-
-
Save w3Abhishek/e103cda275f81a0e7e4a2c8174b42578 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
char str[1000], rev[1000]; | |
int i, j, count = 0; | |
printf("Welcome to CodeWin.org!!!\n"); | |
printf("-----------------------\n"); | |
printf("Enter a String: "); | |
scanf("%s", str); | |
printf("\nString Before Reverse: %s", str); | |
//finding the length of the string | |
while (str[count] != '\0') | |
{ | |
count++; | |
} | |
j = count - 1; | |
//reversing the string by swapping | |
for (i = 0; i < count; i++) | |
{ | |
rev[i] = str[j]; | |
j--; | |
} | |
printf("\nString After Reverse: %s", rev); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment