math.h est inutile
Le prototype de strtoul est :
unsigned long
strtoul(const char * restrict nptr, char ** restrict endptr, int base); |
Tu dois donc l'utiliser ainsi :
strtoul(argv[1], NULL, 16); |
En vérifiant que strtoul ne retourne pas 0, avec errno mis à EINVAL, si le paramètre fourni est incorrect.
Et pour printf(), c'est pas %d (entier), mais %lu (long unsigned) qu'il faut utiliser.