Errors when compiling code.
Hello everyone,
I am very new at C programming and I am following the book from O'Reilly called "Practical C" 3rd Edition.
The exercise at the end of Chapter 1 ask to make a program to print your Name, Social Security number and Date of Birth. This is MY own code I came up with to do this:
Code:
/* This program is designed to produce a Name, Date of Birth and a SS number */
#include <stdio.h>
int dob; /* Date of Birth */
int ssn; /* SS Number */
int full_name; /* Full Name */
int main()
{
dob = 1981;
ssn = 047237554;
full_name = "John W Doe";
}
{
printf("Hi, my name is %d.", full_name);
printf("I was born on %d.", dob);
printf("My SS number is %d.", ssn);
return (0);
}
When I try to compile the program I get the following error:
Code:
Manuel-Velezs-MacBook-Pro:c_files Manolo$ cc -g -o exercise_1 exercise_1.c
exercise_1.c:14:8: error: invalid digit "9" in octal constant
exercise_1.c: In function main:
exercise_1.c:15: warning: assignment makes integer from pointer without a cast
exercise_1.c: At top level:
exercise_1.c:19: error: expected identifier or ( before { token
I feel like I'm missing something really obvious and I'm gonna feel stupid once I can get an idea of what's going on but I love trying to learn this stuff! Thank you in advance for everyones help!