j; clrscr(); printf(â
enter n valueâ); scanf(â%dâ
&n); for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { printf(â%d â
j); } printf(â
â); } getch(); } Output: enter n value : 5 1 1 2 1 2 3 1234 12345 Unit-3 Arrays:introduction-declaration of array-accessing elements of array-storing values in array-operations on array- one dimensional
two dimensional and multi dimensional array
character handling and strings 1. Introductions to array:An array is defined as the collection of similar type of data items stored at contiguous memory locations. Arrays are the derived data type in C programming language which can store the primitive type of data such as int
char
double
float
etc. It also has the capability to store the collection of derived data types
such as pointers
structure
etc. The array is the simplest data structure where each data element can be randomly accessed by using its index number. C array is beneficial if you have to store similar elements. For example
if we want to store the marks of a student in 6 subjects
then we don’t need to define different variables for the marks in the different subject.