I'm fairly new to c and have been trying to figure out how convert an integer into a string of numbers, and this i what i have so far:
long long int inputNum = 0;
char str [20];
int len = 0;
printf("Please enter the integer to be converted,\nit should be no more than 10 digits long: \n");
scanf("%d", &inputNum);
sprintf(str,"%d", inputNum);
len = strlen(str);
printf("%d", len);
return 0;
However im encountering an issue were if the int entered is more than 10 characters long the program will still say that the lenght is 10. Im not sure if this is an issue with data types (long long int for example) or if im just implementing the string impoperly.
len=sprintf(str,...scanf("%lld", &inputNum); printf("%lld", inputNum);