Hi,
I dont know why I am getting segmentation fault when adding the line 'int n'
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char* pStr; // no memory allocation
int n;
printf("enter a string\n");
fgets(pStr,20,stdin);
printf("\nvalue of string is %s\n",pStr);
while(*pStr!='\0')
{
printf("value of string is %c\n",*pStr);
*pStr++;
}
return 0;
}