Mega Code Archive
Convert string to long integer
#include
#include
int main ()
{
char str[256];
char *p;
long l;
printf ("Enter an long value: ");
gets (str);
l = strtol (str, &p, 0);
printf ("Value entered: %ld. Its double: %ld\n", l, l * 2);
return 0;
}