Using the following code:
char *name = malloc(sizeof(char) + 256); printf(\"What is your name? \"); scanf(\"%s\", name); printf(\"Hello %s. Nice to meet y
/*reading string which contains spaces*/ #include int main() { char *c,*p; scanf("%[^\n]s",c); p=c; /*since after reading then pointer points to another location iam using a second pointer to store the base address*/ printf("%s",p); return 0; }