help me.. why this C program doesnt reverse the string ? it crashes... but when i use a character array the code seems to work fine..but the moment i use a pointer to a string..its giving goosebumps...help me solve this..
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main(){
char *String="gokul";
char *Begin =String;
char *End = String + strlen(String) - 1;
char TempChar = '\0';
while (Begin < End)
{
TempChar = *Begin;
*Begin = *End;
*End = TempChar;
Begin++;
End--;
}
puts(String);
}