string reverse without new array
- by Codeguru
hi can anybody tell me the error in this?
#include<stdio.h>
int main()
{
char a[]="abcdefgh";
int i=0;
int n=strlen(a);
char *first;
char *second;
char *c;
*first=a[0];
*second=a[7];
for(i=0;i<=n/2;i++)
{
*c=*first;
*first=*second;
*second=*c;
first++;
second--;
}
for(i=0;i<=7;i++)
{
printf("%c",a[i]);
}
}