Hi there,
I have done a program that at a certain point prints a pointer (char*), and it is compiling but it outputs this warning:
vectorCaracteres.c:42: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘char *’
Here is line 42:
Code:
printf("PONTEIRO -> %d CARÁCTER -> %c\n", vector2[i], *vector2[i]);
vector2 is declared as an char* vector:
Code:
#define TAMANHO 7
(...)
char* vector2 [TAMANHO];
I changed line 42 to the following:
Code:
printf("PONTEIRO -> %d CARÁCTER -> %c\n", (int)vector2[i], *vector2[i]);
and in fact it is working (does not display the warning anymore). Since I don't know if the pointer values displayed are ok, could someone please tell me if I did the right choice or am I going the wrong way?
If someone could answer me I would be very appreciated :]