I want to merge two string arrays into an array:
array 1:
and array 2:
Second name [NUMBER_NAMES] [LEN_NAMES] = {"gogee", "addison"} and I want to put them in the array where the first names and last names can be together < / P>
First, include:
#include & lt; String.h & gt; Now, let's name the string in [[NUMBER_NAMES] [LEN_NAMES]
store four names [sNUMBER_NAMES] [LEN_NAMES]; In the end, loop for each element in the array: for (i = 0; i & lt; NUMBER_NAMES; i ++) {strcpy (name [i], firstnames [i] ); // first name strcat (with name [i]) to start ith name elements, ""); // strcat (name [i]), last name [i]) to add a place between two names; // First name + consensus the last name for the space string
No comments:
Post a Comment