Showing posts with label EXAMPLES. Show all posts
Showing posts with label EXAMPLES. Show all posts

ARRAY IN C

BREIF ABOUT ARRAY

ARRAY: is a collection of similar data type elements.
 Eg: 1) int b[10] means all the elements in array have similar data type i.e int
 2) float a[5] all the elements in array have same data type i.e float

DATA TYPE: means what type of value you can store in a variable.

VARIABLE: is named memory area that can hold the items.

DIFFERENT TYPES OF DATA TYPES:

1) INT means in this data type integer values are stored in variables.
Eg: int a[ 10,20,30,40,50]

2)FLOAT means in this data type only decimal values are allowed to store in variable.
Eg: float b[1.2, 1.5, 8.9,5.0, 4.0]

*In this example there is important point that in float data type we assign integer value to variable b. But in case of int data type we can not assign decimal values to variable.

3) CHAR: is a character type data type.
Eg: char G[a,b,c,d,e ]

4) STRING: is a data type that is collection of characters.
Eg: string A[shubham, visitors, pageviews]

* ALL THE ABOVE FOUR DATA TYPES ARE PRIMITIVE DATA TYPES.

*NON-PRIMITVE DATA TYPES: