Problem Statement:
Dynamic memory allocation/reallocation of an Integer array.

Detailed Description:
Write a program in which you have to:
1. Dynamically allocate an array of integers.
2. Take array size as input from user and allocate memory according to this size.
3. Take values of array elements as an input from user.
4. Print all array values.
5. In this step; double the previous array size (taken in step 2) and reallocate memory for the array according to new array size. For example if user provided array size is 4; now it will become 8, i.e. allocate memory for array having size 8.

6. Now again take values for second half of the array as an input from the user to fill the increased size of an array.(You have already taken the values of first half of the array elements in step 3, now take values for remaining elements i.e. Second half).
7. Print all values of the array.
8. Also confirm that first half values of array are same in both printout statements (step 3 and step 7).

Recommended Answers

All 3 Replies

Problem Statement:
Dynamic memory allocation/reallocation of an Integer array.

Detailed Description:
Write a program in which you have to:
1. Dynamically allocate an array of integers.
2. Take array size as input from user and allocate memory according to this size.
3. Take values of array elements as an input from user.
4. Print all array values.
5. In this step; double the previous array size (taken in step 2) and reallocate memory for the array according to new array size. For example if user provided array size is 4; now it will become 8, i.e. allocate memory for array having size 8.

6. Now again take values for second half of the array as an input from the user to fill the increased size of an array.(You have already taken the values of first half of the array elements in step 3, now take values for remaining elements i.e. Second half).
7. Print all values of the array.
8. Also confirm that first half values of array are same in both printout statements (step 3 and step 7).

So what do you suggest we do with it? We are not here to do your homework, just because you are too lazy to even attempt it. You have to show that you have at least made an effort to start your assignment and we can correct your code/ideas if they're wrong. We (at least, I) refuse to waste time doing other people's assignments for them. See the links below:


Announcement 2
- Regarding Homework Help.

How to ask questions the smart way.

...What about it? Do you have a question? If you haven't noticed, this is a website to answer concrete questions, not do your homework.

And this assignment is very easy! Look in other websites or read the bpook assigned, and compile the program you make, if there is something wrong, then you can ask here, CONCRETE QUESTIONS. Geesh, lazy person!

commented: Agreed! +7

So what do you suggest we do with it? We are not here to do your homework, just because you are too lazy to even attempt it. You have to show that you have at least made an effort to start your assignment and we can correct your code/ideas if they're wrong. We (at least, I) refuse to waste time doing other people's assignments for them. See the links below:


Announcement 2
- Regarding Homework Help.

How to ask questions the smart way.

Wow, yeah, I agree with you! Infact, that assignment seems easy! The person must be too lazy to start it, I wonder where he/she got that this website was to do homework ... I might do it for practice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.