#include<stdio.h>
#include<string.h>intmain(){chars[50],temp;printf("———————————————————————————————————————————");printf("\nProgram to reverse a given string");printf("\n———————————————————————————————————————————");printf("\nEnter the string ");scanf("%s",s);for(inti=0,j=strlen(s)-1;i<j;i++,j--){temp=s[i];s[i]=s[j];s[j]=temp;}printf("\nThe reverse string is %s",s);printf("\n———————————————————————————————————————————\n");return0;}
Output
kodingwindow@kw:~$ gcc kw.c kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program to reverse a given string
———————————————————————————————————————————
Enter the string KodingWindow
The reverse string is wodniwgnidoK
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.