In C, when there are many repeated values, we can use a shorthand array notation to define array. Below program demonstrates same.
1 1 1 1 0 0 2 2 2 2
Note that middle gap of 2 is automatically filled with 0.
This article is contributed by Kaushik Annangi. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- How to return multiple values from a function in C or C++?
- C function argument and return values
- Storage of integer and character values in C
- What are the default values of static variables in C?
- How can I return multiple values from a function?
- Return values of printf() and scanf() in C/C++
- std::tuple, std::pair | Returning multiple values from a function using Tuple and Pair in C++
- Jagged Array or Array of Arrays in C with Examples
- Difference between pointer to an array and array of pointers
- What’s difference between “array” and “&array” for “int array” ?
- Sum of an array using MPI
- Array class in C++
- Pointer vs Array in C
- Pointer to an Array | Array Pointer
- 4 Dimensional Array in C/C++
- How to pass an array by value in C ?
- Why array index starts from zero ?
- Difference between Structure and Array in C
- What is Array Decay in C++? How can it be prevented?
- Difference between pointer and array in C?