Illustration of conversion specification%[] for strings.
main() { char address[80]; printf("Enter address\n"); scanf("%[^\n]", address); printf("%-80s", address); } Output Enter address New Delhi 110 002 New Delhi 110 002