-
basic question to Arrays
Hi
I have a basic question to the use of Arrays (I have been searching the net for the answer without success, so now I try here...)
Somewhere in my code I declare two arrays:
char TagID[16];
....
char tempID[16];
Then I want to copy the CONTENT of the 2nd array into the 1st one.
I´m not sure, but I believe that
TagID=tempID;
will just make tempID refer to the same array as TagID,without copying the content.
Is there any predefined method I can use?
-
Well for strings (char arrays containing a \0 to mark the end of the string), you use the strcpy() call.
For arrays of any other type, use memcpy() or a loop to copy each index yourself
for ( i = 0 ; i < N ; i++ ) b[i] = a[i];