Array as a tool in C programming

Asked By 0 points N/A Posted on -
qa-featured

What can be the use of array in C programming in terms of convince and capabilities?

SHARE
Best Answer by Sharath Reddy
Answered By 0 points N/A #102635

Array as a tool in C programming

qa-featured

Hey pierce..! generally C is defined as a programming language that is developed at AT & T's Bell Laboratories of USA in 1972 by Dennis Ritchie who Designed and written it completely and C became popular due to its ease of use and advantages.

Coming to the array it can store the values of the variables of same data type and can be described in brief by considering the example given below..

#include<stdio.h> //Header files

int main() //Main function starts

{

x=5;

x=10;

//declaration of variable x

printf("x=%d",x);//print the output

return(0);//to return the value

}

In the above program value printed will be of x is 10 without any doubt as the ordinary variables are capable of holding only one value at a time.

Hence array is used as it is collection of similar elements as the elements could be ints,floats,chars, etc….and Usually set of array of the characters is called a "string".

Thank You.

Best Answer
Best Answer
Answered By 562865 points N/A #102636

Array as a tool in C programming

qa-featured

 

In the C programming language, an array is the amount of memory locations where every location is able to save similar type of data which can also be references in an equivalent variable name. It is a shared name set to a group of similar elements and similar quantities. In a program, an array should be declared first before it can actually be used. It is declared in this format:

  • type variable_name[lengthofarray];

String is the term used for array of characters. But it is simply called an array if it is an array of integers or an array of floats. All elements of any particular array should be of the same type. For example, you cannot create an array of 10 if 5 of them are integers and the rest are floats. If you need to create a string array, the values should all be characters. You can declare the array of any basic standard type that C language supports.

  • double height[10];
  • float width[20];
  • int min[9];
  • char name[20];

Login/Register to Answer

Related Questions