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:
Here is line 42:vectorCaracteres.c:42: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘char *’
vector2 is declared as an char* vector:Code:printf("PONTEIRO -> %d CARÁCTER -> %c\n", vector2[i], *vector2[i]);
I changed line 42 to the following:Code:#define TAMANHO 7 (...) char* vector2 [TAMANHO];
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?Code:printf("PONTEIRO -> %d CARÁCTER -> %c\n", (int)vector2[i], *vector2[i]);
If someone could answer me I would be very appreciated :]



LinkBack URL
About LinkBacks


