Write a C program to convert a string to a long integer.
#include<stdio.h>
#include<stdlib.h>
Write a C program to convert a string to a long integer.
int main ()
{
char buffer[123];
unsigned long ul;
printf (“Enter a unsigned number: “);
scanf(“%s”,&buffer);
ul = strtoul (buffer,NULL,0);
printf (“After conversion to long int, the number is: %lu\n”,ul);
return 0;
}
Output:
Enter a unsigned number: 52362
Output: 52362