Working through more compiler warnings...

cat-town
Dan Buch 13 years ago
parent 97043b1831
commit e5fffdeaf1

@ -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)"))

@ -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++;
}

@ -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

@ -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]);

Loading…
Cancel
Save