Sponsorlu Bağlantılar
should be done by using gets function rether than scanf
*/
#include<stdio.h>
#include<string.h>
void reverse(char *p);
int main()
{
char s1[]="Hello World";
char s2[20];
printf("%s\n",s1);
//printf("Enter a string:");
//gets(s2);
reverse (s1);
puts(s2); //Function puts used instead of printf("%s",s2)
system("pause");
}
void reverse(char *p)
{
char *p1, *p2;
char temp;
p1=p;
p2=p1+strlen(p)-1;
printf("First Character:%c Last Character:%c\n",*p1,*p2);
while(p1<p2)
{
temp=*p1;
*p1=*p2;
*p2=temp;
p1++;
p2--;
}
}
Sponsorlu Bağlantılar
Hiç yorum yok:
Yorum Gönder