I need detailed answers please. C programming What are some items in your house
ID: 3766540 • Letter: I
Question
I need detailed answers please.
C programming
What are some items in your house or office that could be represented with an array? Discuss how you can use that array to keep track of those items. What happens if we set an index valuse greater than the size of the array? What is required in order to use a class method for arrays? Can a foreach statement be used with an array to access and change the elements? How? What does it meanto prime the read....in an array? Under what circumstances would parallel arrays be useful?Explanation / Answer
1) We can use all electronic goods of our house as an array, this array will be of string as follows
string goods[]={"TV","Computer","Mobile","Microwave Oven","Refridgerator"};
2) When we set index value greater than size of array then we get Error of "Index out of Bound".
3) When we require class method to use array then we must use array as parameter as follows
void sum(int a[], int n)
{
}
4) C language does not have foreach statement.
5) Prime the read means reading the prime numbers from an array
6) Parallel arrays should be used when we have to store records
int ages[] = {0, 17, 2, 52, 25};
char *names[] = {"None", "Mike", "Billy", "Tom", "Stan"};
int parent[] = {0 /*None*/, 3 /*Tom*/, 1 /*Mike*/, 0 /*None*/, 3 /*Tom*/};
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.