We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 549a1fe commit 031ad53Copy full SHA for 031ad53
Special Programs/9.c
@@ -0,0 +1,37 @@
1
+#include<stdio.h>
2
+int length(char *s)
3
+{
4
+ int i=0;
5
+ while(*(s+i)!='\0')
6
+ {
7
+ i++;
8
+ }
9
+ return i;
10
+}
11
+void reverse(char *s,int len)
12
13
+ int i,j=0;
14
+ char x;
15
+ for(i=len-1;i>=0;i--)
16
17
+ if(i>=j)
18
19
+ x=*(s+j);
20
+ *(s+j)=*(s+i);
21
+ *(s+i)=x;
22
23
+ j++;
24
25
+ *(s+len)='\0';
26
27
+void main()
28
29
+ char s[100];
30
+ int len;
31
+ puts("Enter the string ");
32
+ gets(s);
33
+ len=length(s);
34
+ reverse(s,len);
35
+ puts("Reversed string :");
36
+ puts(s);
37
0 commit comments