Convert string to unsigned long integer: how to use strtoul
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char str[256];
char *p;
unsigned long ul;
printf ("Enter an integer value: ");
gets (str);
ul = strtoul (str, &p, 0);
printf ("Value entered: %lu. Its double: %lu\n", ul, ul * 2);
return 0;
}
Related examples in the same category