Tuesday 13 December 2022

Why Do We Use Arrays

In programming Language we used array to store different variable. This variable is one type of memory position, where we store the data, but variable can store only one data at a time, so, if we want to store further than one data at a time, also we can use array.



Arrays a kind of data structure that can store a fixed-size consecutive collection of fundamentals of the same type. An array is used to store a collection of data, but it's frequently more useful to suppose of an array as a collection of variables of the same type.

An array is one type of a data structure for storing more than one data value at a time that has a similar data type. The data values of an array are allocated at next to memory locations. These memory locations are called data elements of that array. The total number of elements presents in an array is called length.

  • Arrays are best options for storing multiple values in a single variable.
  • Arrays are always better for processing many values easily and quickly.
  • In Arrays Sorting and searching the values is easier.

Example

Declaration an array

int[] age = new int[5];

Initialization of an array

int[] arr = new int[5];

arr[0] = 10;

arr[1] = 20;

arr[2] = 30;

arr[3] = 40;

arr[4] = 50;

:C contains following topics at TCCI:

Introduction to C, Basic Syntax, Token, Data Types and Variables, Constants, Literals, Storage class, Operators, Loop Controls, For Loop, While Loop, Do-While Loop, Decision Making, Arrays, String, Function, Pointer, Structure, Union, Type Casting, Recursion, Files, Command Line Argument.

For More Information

Call us @ +91 9825618292

Visit us @ http://tccicomputercoaching.com

 

No comments:

Post a Comment