Question

In: Computer Science

Define parallel arrays, tell how the data in each array is accessed and give an example...

Define parallel arrays, tell how the data in each array is accessed and give an example of parallel arrays.

Solutions

Expert Solution

Define parallel arrays, tell how the data in each array is accessed and give an example of parallel arrays.

Answer:

Parallel arrays:

two or more arrays of the same size are called parallel arrays

the arrays are the same data types or different data types

how the data in each array is accessed:

the data accessed from arrays by using the index value

using index value only data accessed from parallel arrays

example of parallel arrays.

CODE:

#include <stdio.h>

int main()
{
int i;
  
//parallel arrays
int Id[3]= {101,102,103};
   char names[3][10]={"Ramesh","Saisri","Suresh"};
float Salary[3]={20000.00,25000.00,22000.00};
  
//print parallel arrays by using index value.
printf("ID NAMES SALARY\n");
for(i=0;i<3;i++)
{
printf("%d %s %.2f\n",Id[i],names[i],Salary[i]);
}

return 0;
}

OUTPUT:

SCREENSHOT OF THE CODE:


Related Solutions

Read and print parallel array - How can this be made to read parallel arrays and...
Read and print parallel array - How can this be made to read parallel arrays and then print them? The program presented here is intended to read from the text file and build parallel arrays. Then it will print as shown. The first line will not be stored in the array. The second line will be stored in firstArray[] and the third line will then be stored in secondArray[] and the arrays will repeat until the file is read. begin...
Define, differentiate, tell the cellular location and give an example of each of the two different...
Define, differentiate, tell the cellular location and give an example of each of the two different types of ways a mammalian cell can generation ATP from ADP and Pi.
Define, differentiate, tell the cellular location and give an example of each of the two different...
Define, differentiate, tell the cellular location and give an example of each of the two different types of ways a mammalian cell can generation ATP from ADP and Pi.
Write a program the declares and uses two parallel arrays. One array for storing the names...
Write a program the declares and uses two parallel arrays. One array for storing the names of countries and a second array for storing the populations of those countries. As you can see per the following the Country name and it's corresponding Population are stored at the same element index in each array. China 1367960000 India 1262670000 United States 319111000 Indonesia 252164800 Brazil 203462000 Pakistan 188172000 Nigeria 178517000 Bangladesh 157339000 Russia 146149200 Japan 127090000 In the main method write a...
Write a program the declares and uses two parallel arrays. One array for storing the names...
Write a program the declares and uses two parallel arrays. One array for storing the names of countries and a second array for storing the populations of those countries. As you can see per the following the Country name and it's corresponding Population are stored at the same element index in each array. China 1367960000 India 1262670000 United States 319111000 Indonesia 252164800 Brazil 203462000 Pakistan 188172000 Nigeria 178517000 Bangladesh 157339000 Russia 146149200 Japan 127090000 In the main method write a...
Give an example of how to build an array of objects of a super class with...
Give an example of how to build an array of objects of a super class with its subclass objects. As well as, use an enhanced for-loop to traverse through the array while calling a static method(superclass x). Finally, create a static method for the class that has the parent class reference variable.
Define implicit and explicit goals. Give an example of each.
Define implicit and explicit goals. Give an example of each.
Define endocrine, paracrine, and autocrine and give example of each.
Define endocrine, paracrine, and autocrine and give example of each.
Define each of Weber's three types of authority and give an example of each.
Define each of Weber's three types of authority and give an example of each.
Define a bilateral contract and a unilateral contract,  and give an example of each. In your example...
Define a bilateral contract and a unilateral contract,  and give an example of each. In your example of a bilateral contract, identify and describe the four elements that are necessary for a contract to exist.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT