Need help with copying array object to a temp array object using a for loop (see code + comments below)..... Thanks in advance!!!!
int counter;
char buffer[] = "this is what i want 0 ignore the rest after the zero"; //
char command[sizeof(buffer)];
for ( counter = 0; counter < sizeof(buffer); counter++ ){
if ( buffer[counter] == '0' ){
break; // Exit loop (Should Exit)
}
command[counter] = buffer[counter]; // Copy array object into new array
printf("%c",command[counter]);
}
printf("\n",NULL);
printf("%s\n",command); // However when I print it contains the whole array this shouldnt be is should only contain "this is what i want "