I believe what you're trying to do is reading a string that contains spaces (e.g. in the name or in the address). scanf() stops reading from the standard input when it hits a whitespace or end-of-line character. So it is not suited for your needs.
You should use fgets() instead. You can set the target buffer, the maximum number of bytes to read and where to read from (stdin). This introduces a new problem though: fgets() also returns the newline character entered, so one has to manually remove it if it is unwanted. For this, I created a function called GetString().
I also took the liberty to make your output formatting better. Please, read carefully how printf() works. You can specify the width of the output and even you can do so that this width is not fixed in the format string, but comes as an additional argument before the variable to be output (specified via the * in the format string). Also, you can specify whether this should be left justifier (-) or right justified (default behaviour).
Here's the code for you
#include <stdio.h>
#define NAME_LENGTH 30
#define ADDRESS_LENGTH 50
#define ID_LENGTH 20
#define STATE_LENGTH 30
#define POSTAL_CODE_LENGTH 8
void GetString(const char * prompt, char * buffer, size_t size)
{
printf("%s", prompt);
fgets(buffer, size, stdin);
// Removing the newline character
for (char * ch = buffer; *ch != '\0'; ch++)
{
if (*ch == '\n')
{
*ch = '\0';
break;
}
}
}
int main()
{
char name[NAME_LENGTH];
char id[ID_LENGTH];
char add[ADDRESS_LENGTH];
char state[STATE_LENGTH];
int postalCode;
// Getting input from user
GetString("Enter your name: ", name, sizeof(name));
GetString("Enter your ID number: ", id, sizeof(id));
GetString("Enter your address: ", add, sizeof(add));
GetString("Enter your state: ", state, sizeof(state));
printf("Postal code: ");
scanf("%d", &postalCode);
// Printing the header
printf("%-*s%-*s%-*s\n", NAME_LENGTH, "Name", ID_LENGTH, "ID", ADDRESS_LENGTH + POSTAL_CODE_LENGTH + STATE_LENGTH, "Address");
for (int i = 0; i < NAME_LENGTH + ID_LENGTH + ADDRESS_LENGTH + POSTAL_CODE_LENGTH + STATE_LENGTH; i++)
printf("=");
printf("\n");
// Printing the data
printf("%-*s%-*s%s %d %s\n", NAME_LENGTH, name, ID_LENGTH, id, add, postalCode, state);
return 0;
}