reverse of a string (2)

No comments

#include<stdio.h>
void boss(char *p)

{char a;
int i,j;


for(j=0;p[j]!='\0';j++)
           {
            for(i=0;i<j;i++)
           {
                 a = p[i];
                 p[i]=p[j];
                 p[j]=a;
  }
}

return;
}

int main()
{
           char s[20];
          printf("Enter The string to be revresedn  : ");
           gets(s);
  boss (s);
  printf("The Reversed string is    :  %s  ",s);

            return 0;
}

No comments :

Post a Comment