+ 4
How to reverse a string in C language??
I want to reverse a string in C . But I don't know if I have to use Arrays in C or Some kind of iteration or looping. Please help me.
6 odpowiedzi
+ 3
Take another array , and in that copy each char from last to first .
Or simply use strrev()
+ 2
https://code.sololearn.com/csnpYPK7hDKC/?ref=app
You can search in code section more.
+ 2
Thanks a lot
+ 2
Thanks
0
#include<stdio.h>
int main() {
int i,j,n;
char s[100];
printf("enter....");
scanf("%[^\n]s",s);
n=strlen(s);
printf("len=%d\n",n);
for(i=n-1;i>=0;i--){
n=n-1;
printf("%c",s[n]);}
return 0;
}
0
How to creat backslash on android phone?