Allocate memory for a larger array, then copy all elements from array1 to array2. You can also use the C function realloc() (dunno the C++ equivelent) which effectively does the same thing for you (of course, that only works on dynamically allocated memory, not on statically allocated memory). If you use realloc() be sure to use a temp pointer and check the return value, if it fails your original memory is still intact and needs to be free'ed.

Re: how do I turn this arrayinto a larger array?

Originally posted by clowns119 I have this array and I want to make it a 240 by 300 array instead, how would I do that?

Please use code tags for posting code. I am not sure what you are asking. Are you asking to change your program to have a 240x300 sized array? I see no 2 dimensional arrays in your program, so I assume this is not the case. If it is, please show only the relevant code for your problem. Or are you asking how to change the size of an array at runtime? This cannot be done. Either allocate enough space originally for the maximum future size, or use dynamic allocation for the original, then dynamically allocate the new size, copy the old to the new (if you wish to maintain the data from the old), and delete the old.

Originally posted by mitakeet ...You can also use the C function realloc()...

I did not realize until now that realloc maintains the data in the new block. From the MSDN realloc() page: "The contents of the block are unchanged up to the shorter of the new and old sizes, although the new block can be in a different location." :)

I don't know much about arrays, I got this from someone who was trying to help me. I have a .txt file which lists a lot of numbers and I want those numbers to be displayed in a 240X300 array. I guess I am going about it the wrong way so how would I do it?

Generally speaking we don't do your work for you, we help you with problems in your code. Ask the person who gave you the code or hope someone will be kind here. Or, you can take a stab at doing it yourself and then ask us for help with YOUR code.

Originally posted by clowns119 I guess I am going about it the wrong way so how would I do it?

Yes, you are. You should start coding something from scratch. First of all, start with a small program that deals with a single dimension array. Then move on to 2-dimensional arrays. Then move on to reading information from a file. And, finally combine the last 2 to make your program. You should learn incrementally, so you can learn the details of each step - rather than be blasted with 100 errors in one large program of which you know nothing about. mitakeet is right - we are not going to do this work for you. If you have problems with a specific thing in one of your own programs, let us know, and we are here to help.

ok I have a new question, I am tryin to learn from scatch and first I learned how to create a 1D array and that worked great and I am good at that now. The next step is creating a 2D array and I tried with this code:
#include<iostream.h>

Yes, please stop asking the same question in more than one thread. The questions in each thread you have started are all basically the same problem, and you should have never started more than one thread on this problem.

It looks to me like you need a tutorial on C/C++. You are doing the right thing by starting with smaller programs, but you should not be asking about problems dealing with syntax, when it is obvious that you have not even looked at a tutorial, yet.