large input in c..?

How to input 100 digits number in C using arrays ?
ex:if input 987654321 is given, the values must be directly stored into array and the array would be ex[0]=9,ex[1]=8,…ex[8]=1

using a loop ?

You could use char type array, then input as scanf("%s",array). You can now convert this character array to integer array(if you want to) as arr[i]=array[i]-48

1 Like

loop would definitely take a long time,so better to avoid loop.
as my question is about to convert large numbers…
is it possi to use directly any function…?

it almost seemed perfect,but if my no is something 50 digits long,then it would be problem as it takes 50 loops to convert.Any optimization…??

If it is more than usual limits it will take the length of the input to convert, there is no better way to convert, unless you are okay with losing precision.
But while you are converting you can convert more than one digit into a single array element. While this won’t change the conversion time, it will optimize the further reads you may have.

2 Likes