How do I copy a charachter from an array to another array? I tried using a for but the second array gets filled with nonsense because it's length is tha same as the first array even though it has fewer charachters.
>>57952440
I have to make a new array with the charachters from the even position in the original array.
Use a vector?
for (int i = 0, counter =0; i < size; i++)
if ( original[i] % 2 == 0)
new_array[counter] = original[i]
counter++
>>57952440
C++std::string first = "whatever";
std::string second = "first";
Cconst char * array = "whatever";
char * second = malloc( strlen( array ) + 1);
memcpy( second, array, strlen( array ) + 1);
>>57956002const char * array = "whatever";
char *second = strdup(array);
>>57956032
Yes. This is cleaner - disregard my previous post.
>>57954446
lmao dude, hit the books
what lang?
/g/ is worse than ever lately
>>57952440
Use the actual container, not c-strings
>>57956002
>std::string second = "first";
what are you doing