Question

How do you implement simple data types as arrays and how do you implement structured data...

How do you implement simple data types as arrays and how do you implement structured data types as arrays? What are some difficulties that face a programmer in implementing either? Give some examples.

Please be as detailed as possible. Thank you!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Following is the way in which we implement simple data types as arrays:
int a[10] OR string b[10]
So the above two will define an array of size 10 each with one of them having an integer as the data type and other has a string as the data type.

In case of structure data type arrays
struct student{
int id;
string name;
int roll;
}

So in the above case, a structure is defined and thus if we need to make an array out of it. It would be done in the similar way but with the little different syntax.

struct student students[10].

So the above declaration will create an array of students structure with 10 students.

The problems which programmer face while writing the structure is kind of one-time problem, as once the structure would be needed to be written then everything would be at one place and then with the help of one structure array variable we can access the value for each index.
But if we would have to do the same thing with the simple data type then we may need to define so many arrays and then we would need to update and remember all of them. But the implementation of simple data types isv very simple for the programmer.

That was a nice question to answer
Friend, If you have any doubts in understanding do let me know in the comment section. I will be happy to help you further.
Thanks


Add a comment
Know the answer?
Add Answer to:
How do you implement simple data types as arrays and how do you implement structured data...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT