Input an integer array without spaces in C Last Updated : 13 Dec, 2018 Comments Improve Suggest changes Like Article Like Report How to input a large number (a number that cannot be stored even in long long int) without spaces? We need this large number in an integer array such that every array element stores a single digit. Input : 10000000000000000000000000000000000000000000000 We need to read it in an arr[] = {1, 0, 0...., 0} In C scanf(), we can specify count of digits to read at a time. Here we need to simply read one digit at a time, so we use %1d. C // C program to read a large number digit by digit #include <stdio.h> int main() { // array to store digits int a[100000]; int i, number_of_digits; scanf("%d", &number_of_digits); for (i = 0; i < number_of_digits; i++) { // %1d reads a single digit scanf("%1d", &a[i]); } for (i = 0; i < number_of_digits; i++) printf("%d ", a[i]); return 0; } Input : 27 123456789123456789123456789 Output : 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 We can also use above style to read any number of fixed digits. For example, below code reads a large number in groups of 3 digits. C // C program to read a large number digit by digit #include <stdio.h> int main() { // array to store digits int a[100000]; int i, count; scanf("%d", &count); for (i = 0; i < count; i++) { // %1d reads a single digit scanf("%3d", &a[i]); } for (i = 0; i < count; i++) printf("%d ", a[i]); return 0; } Input : 9 123456789123456789123456789 Output : 123 456 789 123 456 789 123 456 789 Same concept can be used when we read from a file using fscanf() Comment More infoAdvertise with us Next Article Input an integer array without spaces in C A AnmolAgarwal Follow Improve Article Tags : Misc C Language C++ c-input-output cpp-input-output C-Input and Output Quiz +2 More Practice Tags : CPPMisc Similar Reads How to Take Input in Array in C++? Arrays in C++ are derived data types that can contain multiple elements of the same data type. They are generally used when we want to store multiple elements of a particular data type under the same name. We can access different array elements using their index as they are stored sequentially in th 3 min read C Program to Insert an Element in an Array In this article, we will learn how to insert an element into an array in C.C arrays have a fixed size, so we cannot dynamically increase their memory. However, we can insert an element if the array already have enough memory space to accommodate the new elementsInsert Element at Specific PositionTo 3 min read How to store words in an array in C? We all know how to store a word or String, how to store characters in an array, etc. This article will help you understand how to store words in an array in C. To store the words, a 2-D char array is required. In this 2-D array, each row will contain a word each. Hence the rows will denote the index 2 min read Pass Array to Functions in C Passing an array to a function allows the function to directly access and modify the original array. In this article, we will learn how to pass arrays to functions in C.In C, arrays are always passed to function as pointers. They cannot be passed by value because of the array decay due to which, whe 3 min read Pointer vs Array in C Most of the time, pointer and array accesses can be treated as acting the same, the major exceptions being:  1. the sizeof operator sizeof(array) returns the amount of memory used by all elements in the array sizeof(pointer) only returns the amount of memory used by the pointer variable itself 2. 1 min read Like