473,387 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Store an array to an integer array??

Hi all:

Is it possible to store an integer array to another integer array?
Or should I use an array of pointers that will point to a particular
array?

Thanks for the help.

Dec 11 '06 #1
7 2707
rh*******@gmail.com writes:
Is it possible to store an integer array to another integer array?
Do you mean an array of integer arrays? Just like this:
int x[2][3];
Or should I use an array of pointers that will point to a particular
array?
What are you trying to do?
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Dec 11 '06 #2

What are you trying to do?
--
For example, I have 4 integer arrays with size 4:

my_array1, my_array2, my_array3, my_array4..
each array will contain 4 integers..

Now I would like to store these 4 arrays in anothe location because I
would like to print them later on.. Can I store them in anothe array?
or should I create an array that points to them?
thanks..

Dec 11 '06 #3
rh*******@gmail.com wrote:
Hi all:

Is it possible to store an integer array to another integer array?
If they're of the same type and size, then yes.
Or should I use an array of pointers that will point to a particular
array?
Can't say unless you tell us what you're trying to do. In programming
there're, usually, many ways to accomplish something. What is most
suitable depends on the details of the specific program and it's
environment.

Dec 11 '06 #4
rh*******@gmail.com wrote:
What are you trying to do?
--

For example, I have 4 integer arrays with size 4:

my_array1, my_array2, my_array3, my_array4..
each array will contain 4 integers..

Now I would like to store these 4 arrays in anothe location because I
would like to print them later on.. Can I store them in anothe array?
or should I create an array that points to them?
If your arrays are local and the code to print them will be elsewhere
in scope then you'll need to store these arrays somewhere else, just
pointing to them will not be enough.

If they're dynamically allocated or declared static or global then
holding pointers to them is sufficient.

Dec 11 '06 #5

Can't say unless you tell us what you're trying to do. In programming
there're, usually, many ways to accomplish something. What is most
suitable depends on the details of the specific program and it's
environment.
I'm trying to find a "fixed point" of a number that is for ex:

954 (high to lo) - 495 (lo to high) = 495
then next step
954 (high to lo) - 495 (lo to high) = 495

from here, I can say that 495 is a fixed point, I would like to put
this in a "storage" (array??) so I can print all the fixed points that
I've found later..(Cause I need to check for other fixed points of
other numbers)

NOTE: 495 is stored in an array of size 3, I had to store each digits
in an array to perform my sorting..

thanks for the help..

Dec 11 '06 #6
rhitz1...@gmail.com wrote:
Can't say unless you tell us what you're trying to do. In programming
there're, usually, many ways to accomplish something. What is most
suitable depends on the details of the specific program and it's
environment.

I'm trying to find a "fixed point" of a number that is for ex:

954 (high to lo) - 495 (lo to high) = 495
then next step
954 (high to lo) - 495 (lo to high) = 495

from here, I can say that 495 is a fixed point, I would like to put
this in a "storage" (array??) so I can print all the fixed points that
I've found later..(Cause I need to check for other fixed points of
other numbers)

NOTE: 495 is stored in an array of size 3, I had to store each digits
in an array to perform my sorting..
See my reply to you in the other thread.

Dec 11 '06 #7
On 10 Dec 2006 19:07:28 -0800, rh*******@gmail.com wrote:
>Hi all:

Is it possible to store an integer array to another integer array?
Or should I use an array of pointers that will point to a particular
array?
You can always copy array elements using a loop with an assignment
statement as long as each from_element processed by the loop has be
assigned or initialized with a value.

If you are referring to one dimensional arrays, then memcpy will copy
data from one array to another as long as the number of bytes you
specify is not larger than the size of either array. This may or may
not be "better" than using a loop with an assignment statement.

If the arrays are multi-dimensional with identical dimensions, memcpy
will still work.

If the arrays are multi-dimensional with different dimensions, memcpy
can still be used but there may be some "boundary" issues.
Remove del for email
Dec 12 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the...
11
by: deko | last post by:
I need to create a basic one-dimensional array of strings, but I don't know how many strings I'm going to have until the code is finished looping. pseudo code: Dim astrMyArray() Do While Not...
4
by: RubenDV | last post by:
I am trying to make a cipher with a 256-bit key but i have no idea how the store this key without using arrays of ints or something like that. I just need a type that is big enough to hold the...
2
by: martin | last post by:
Hi, I would appreciate knowing the best way to store a two dimensional array, and the bind that array to a dropdownlist. The original array is in the form integer, string and the list...
10
by: Peter Stojkovic | last post by:
I want store an integer-array of 1000 Values in a blob in a SQL-database. I will do this every 10 Seconds. How can I do this ???? What datatypes a have to use ??? Thanks
0
by: sreemati | last post by:
Hi Everyone, I had an ASP page which takes all the column values in array and then passes it to store procedure. Now one of the variable in the store procedure needs to be changed from int to real...
4
karthickbabu
by: karthickbabu | last post by:
Is Possible to store a value to declared Variable from Text Box at run time. I want to store a value from Text Box in 2 dimension array. First Value can be sotred in variable(0,0). If i press enter...
0
by: JuAn2226 | last post by:
hi this my code Private Sub Form_Load() car_count = 0 Cumulative_Speed = 0 End Sub Private Sub Timer1_Timer() Dim tmpNumber As Integer
0
by: harshad | last post by:
Dear All,Here I am facing problem to store image.I am trying to store byte array(image) in to session variable so at time of update I will got that byte array and I do my update. here i am given...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.