Skip to content

Instantly share code, notes, and snippets.

@faisal95bd
Last active October 27, 2022 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faisal95bd/558ee75a18e0f583580c164ecfe203d4 to your computer and use it in GitHub Desktop.
Save faisal95bd/558ee75a18e0f583580c164ecfe203d4 to your computer and use it in GitHub Desktop.
3 - Reverse string
#include <stdio.h>
#include <string.h>
int main()
{
char str[100], strmain[100], strup[100];
printf("Enter the string to reverse:\n");
gets(str);
for (int i = 0; str[i] != '\0'; i++) {
strup[i] = toupper(str[i]);
}
strcpy(strmain, strup);
strrev(strup);
printf("Final result: %s%s \n", strmain, strup);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment