hey.

I'm just trying to find out the length of a long int in C.

I'm trying to accept a number from the user as :

{

long int i;

printf("Enter a no: ");

scanf("&ld", &i);

..

......

}

The user can give any integer for i -- lets say from 1 digit to 20 digits

So, how do i find the length of the number he gives?

Suppose say he enters " 62351235123512" it should display length=14

Also, I'm unable to get if i need to specify as 'long' or 'double' when declaring ' int i' ??

Please help me on this.

I've tried using ' itoa' function and also sprintf() function but unable to get it !!

Thx

I'm just trying to find out the length of a long int in C.

I'm trying to accept a number from the user as :

{

long int i;

printf("Enter a no: ");

scanf("&ld", &i);

..

......

}

The user can give any integer for i -- lets say from 1 digit to 20 digits

So, how do i find the length of the number he gives?

Suppose say he enters " 62351235123512" it should display length=14

Also, I'm unable to get if i need to specify as 'long' or 'double' when declaring ' int i' ??

Please help me on this.

I've tried using ' itoa' function and also sprintf() function but unable to get it !!

Thx