Detailed Discription of C Language Array [Tutorial]

Array



                                                            Introduction:                                                             


There are many Applications which require to process a group of Data items that are of same type such as double , float , int or char.
For example:
we can define an Array of a list of marks obtained in an Examination by a group of Students. In such a situation, it is necessary to have a unique variable which holds a group of elements.



                                                               Definition:                                                              

  • Array is a group of Homogeneous data type elements, that consumes a continous Memory Area.
  • Array is used for Multiple inputs in a single variable.
  • An Array is a Data structure which stores a group of elements of the same kind.
  • Array can also be defined as an ordered list of Homogenous data elements.
These elements may be of type float,char,int or double. All these array elements are stored in consecutive memory locations on RAM.  An array is described by a single name or an identifier. Each individual data item in the Array is referenced by a subscript (or index) enclosed in a pair of square brackets i.e [] . This subscript indicates the position of an individual data item in an Array. Sometimes an Array is called as a subscripted variable because of the presence of subscripts.

Note: Subscript must be an unsigned Positive Integer.



                                                        Classification of Arrays:                                               


Types of Array

Arrays are classified into:
  1. One-dimensional array
  2. Multi-dimensional arrays
Further the multi-demensional arrays are classified into:
  1. Two-dimensional array
  2. Three-dimensional array
Note: The dimensionality is determined by the number of subscripts in an array. If there is one subscript, then Array is One-dimensional. If there are two subscripts , then Array is Two-dimensional and so on.



                                                       Declaration of Arrays:                                                    


Array Elements

Array must be declared by using the Data Type before it appears in the Program. At the same time of declaration, the size of an Array must also be specified with in a pair of square brackets. This allows the Compiler to decide on how much memory is to be reserved for the Array.



                                                         Rules for Subscripts:                                                    

  1. Each subscript must be a positive integer constant or an expression.
  2. Nesting of subscripts not allowed i.e [ [ ] ] .
  3. The maximum subscript appearing in a program for subscripted variable should not exceed the declared one. Example:  int A[5] , The subscripts for the array A should not be exceed from 5.
  4. C does not perform bounds checking.
  5. The subscript value ranges from 0 to one less than the size of array. Example: If the size of an array is 10, then the First subscript is 0 and the Last subscript is 9.
Note: An ordinary variable can hold only single data value where as Array can store multiple data values of same data type.

                                                                   That's All

0 Response to "Detailed Discription of C Language Array [Tutorial]"

Post a Comment

Popular Posts

Label

1 Sidebar 2 Columns 3 Columns Footer 3rdball 4 Columns Footer Alex Alvaro Antsasia Arlinadesign Averie Barry BASIC CONCEPTS Basil Bayna Fast BeautyPress BeautyTemplates Beckel Best Best - Clean Beyonce Pro BioMag BlackMag Blanter Nova Blogger Card Bloggertheme9 Blogish Bpress Brakt C LANGUAGE C PROGRAMS C++ LANGUAGE C++ PROGRAMS Carella Cellar Charlotte Chooko Lite Clara Clean Combo One Cooperate Crusade Darry Dorman Dreamway Dunia Blanter eCars EduAcademy EducationPress Elise Elvan Eva Everyday FabNews Fashion Fashion Blogger Template Fashion Gossip FastCars Fedo FlashNews Fredy Portfolio Gaming Globus GoodTime Goomsite HTML LANGUAGE iGaming Indicate Innove Insomnia InspiredNews iSoft Jasmine Kalem Landscaping Lashira Lavelle Lily Fashion Limax Linea Lionex Luminescence Lite Lumix Luxury Magazine MagazinePro MAJOR DIFFERENCES MarketingBlog Martin MaxiMag Medica Mega Melissa Mercury MeshMag Minimag Minimalist MiniNews MovieKhor msdesignbd MusicLand Neko NetZine New Spread News16 Newsflash NewsForce NewsIdea Newspaper News NewsPro Nubie Fast Odd Themes Optima PaperMag PaperMag blog Parhlo Perfection Personal Personal Blog Photosout PixelZ Power Blog Premium Themes ProfileMag Purez Rano ReadNews Real estate Remito Grid Responsive Revo Robusta Rotario Saara SeoBoost Settle Shouters Simple Catch SimpleClean Sketchly SNews SolidMag Someo Sophie Sora Sora Bank Sora Home Sora News Responsive Sora One Sora Ribbon Spido Sticko Stucco Sure Mag Swift Tech Tech Pro Techia Techmax TechSpot TemplateClue Templateism Templatesilk Templatesyard Templatezy The Freelancer TheBlogger TheFocus Themeforest Themexpose TIPS AND TRICKS Topside TravelMag Trendy Trendy Travel Tumblr Under Construction Uong Jowo Veethemes Vertox VideoPlay Vigo Waverly way2themes WebBiz Wedding X-Mag Zealer ZetaMag