c les pointeurs - avertissement pour le format '%x' attend des arguments du type "unsigned int"

Je suis en train de lire le Piratage de l'art de l'exploitation et il est un exemple là-bas que je n'arrive pas à obtenir correct. Tentez de compiler les résultats dans l'erreur:

./addressof.c: In function main’:
./addressof.c:8:4: warning: format ‘%x expects argument of type unsigned int’,
but argument 2 has type int *’ [-Wformat]


#include <stdio.h>
int main() {
   int int_var = 5;
   int *int_ptr;

   int_ptr = &int_var; //Put the address of int_var into int_ptr.

   printf("int_ptr = 0x%08x\n", int_ptr);
   printf("&int_ptr = 0x%08x\n", &int_ptr);
   printf("*int_ptr = 0x%08x\n\n", *int_ptr);

   printf("int_var is located at 0x%08x and contains %d\n", &int_var, int_var);
   printf("int_ptr is located at 0x%08x, contains 0x%08x, and points to %d\n\n",
      &int_ptr, int_ptr, *int_ptr);
}

Je comprends d'où l'erreur est, je ne sais pas comment résoudre ce problème.

InformationsquelleAutor bigl | 2012-03-14