diff --git a/Makefile b/Makefile index e721092..846874e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CFLAGS=-Wall -Wextra -pedantic-errors -g -DNDEBUG +CFLAGS=-Wall -Wextra -pedantic -g -DNDEBUG EXERCISES = $(patsubst %.c,%,$(shell ls ex*.c | egrep -v "ex(19|22)")) diff --git a/ex15.c b/ex15.c index 1621a1c..8480c5d 100644 --- a/ex15.c +++ b/ex15.c @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) int i; char **arg = argv; for(i = 0; i < argc; i++) { - printf("argument %d is '%s' (address = %p)\n", i, *arg, arg); + printf("argument %d is '%s' (address = %p)\n", i, *arg, (void *)arg); arg++; } diff --git a/ex16.c b/ex16.c index e586bab..9b4c240 100644 --- a/ex16.c +++ b/ex16.c @@ -15,7 +15,7 @@ struct Person *Person_create(char *name, int age, int height, int weight) struct Person *who = malloc(sizeof(struct Person)); assert(who != NULL); - who->name = strdup(name); + who->name = strdup((char *)name); who->age = age; who->height = height; who->weight = weight; @@ -49,10 +49,10 @@ int main(int argc, char *argv[]) "Frank Blank", 20, 72, 180); // print them out and where they are in memory - printf("Joe is at memory location %p:\n", joe); + printf("Joe is at memory location %p:\n", (void *)joe); Person_print(joe); - printf("Frank is at memory location %p:\n", frank); + printf("Frank is at memory location %p:\n", (void *)frank); Person_print(frank); // make everyone age 20 years and print them again diff --git a/ex18.c b/ex18.c index 5a5a77a..f6735b3 100644 --- a/ex18.c +++ b/ex18.c @@ -81,7 +81,7 @@ void test_sorting(int *numbers, int count, compare_cb cmp) free(sorted); - unsigned char *data = (unsigned char *)cmp; + unsigned char *data = (unsigned char *)&cmp; for(i = 0; i < 25; i++) { printf("%0x:", data[i]);