I have written a code to reverse the string . It is not working . Is my logic right? How to make it work . I wish to make this one work . I have written using some other logic and it is working . I wish to know how to fix this logic.
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
char *a="This is Anfield";
char *b;
int count=0;
while(*a!='\0')
{
count++;
a++;
}
int len=count+1;
int i,j;
i=j=0;
for(i=count;i>=0;i--)
{
*(a+count)=*(b+j);
j++;
}
printf("\n%s",*b);
return 0;
}
There is some run time error in "char *b" Line..