Ex3 How to Break It

I am going through the exercises and I am currently on Exercise 3: Formatted Printing.

I am stuck in the subsection ‘How to Break It’ of exercise 3. This section describes how to break the the program intentionally by modifying the script and omitting a few variables and functions such as ‘age’ and ‘printf’. I have done this to the code. However, I am unable to get this broken code compiled after modifying the ex3.c script.

Here is an example of what happens when the variable ‘age’ is removed from line 8 and then trying to compile after:

@:~/c$ make ex3
cc -Wall -g ex3.c -o ex3
ex3.c: In function ‘main’:
ex3.c:8:34: error: expected expression before ‘)’ token
printf (“i am %d years old.\n”,);
^
ex3.c:5:7: warning: unused variable ‘age’ [-Wunused-variable]
int age = 10;
^
: recipe for target ‘ex3’ failed
make: *** [ex3] Error 1

Make does not compile the broken script.

I am able to compile and build the code successfully when the ‘age’ variable is reinserted back to the correct line. However, I am unable to intentionally break the code and then compile this broken script according to the book, in order to get the desired crash build.

I am using Ubuntu 16.04.3

Is there anyway I can get the desired broken script to compile? Thanks in advance for any help you can provide.

Get rid of the comma (,) too and it should compile, but some smarter compilers might still complain.