Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to loop the values of one array into another?
How to loop the values of one array into another?
For the convenience of explanation, two integer arrays A and B are defined, and the value in A is assigned to B. ..

Internationalorganizations (same as international organizations)

Answer [4]

=

{ 1,2,3,4},

b[4];

1、

Assign values one by one through array traversal.

Define the loop variable int

Me;

For (me)

=

0;

I

& lt

4;

I

++)

b[i]

=

a[I];

The function of this program is to traverse array A and assign values to the corresponding elements of array B one by one.

2、

With the help of memory copy function memcpy, the whole assignment is completed.

empty

*memcpy(void

* Daylight Saving Time,

empty

*src,

Size _t

Size);

The function is used to allocate the size byte data on src to dst.

When calling this function, you need to refer to the header file cstring, that is,

# Including

The code to allocate the array is

memcpy(b,a,sizeof(a));