954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Dynamic memory allocation/reallocation of an Integer array

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).

saalvi
Newbie Poster
3 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
 

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 arenot 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.

amrith92
Junior Poster
188 posts since Jul 2008
Reputation Points: 130
Solved Threads: 23
 

...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!

MariaERamos
Newbie Poster
10 posts since May 2009
Reputation Points: 17
Solved Threads: 0
 

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.

MariaERamos
Newbie Poster
10 posts since May 2009
Reputation Points: 17
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You