I am trying to read input using scanf
and storing into char *
dynamically as specified by GCC manual.
But it is giving compile time error.
char *string;
if (scanf ("%as",&string) != 1){
//some code
}
else{
printf("%s\n", *string);
free(string);
//some code
}
Edit:
scanf("%ms")
also works.(see answers)