reverse a String without using C functions ?
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
int i=0,l,l1;
char str[100];
printf("enter string:");
scanf("%s",&str);
while(str[i])
i++;
l=i;
for(i=0;i<=(l-1)/2;i++)
{
char t=str[i];
str[i]=str[l-i-1];
str[l-i-1]=t;
}
str[l]=0;
printf("\n\nreversed string is:%d",str);
getch();
return 0;
}
Comments
Post a Comment