I am learning C and want to learn how I can copy the remaining characters leftover in the string after using strncpy
. I would like to have the string Hello World
broken down into two separate lines.
For example:
int main() {
char someString[13] = "Hello World!\n";
char temp[13];
//copy only the first 4 chars into string temp
strncpy(temp, someString, 4);
printf("%s\n", temp); //output: Hell
}
How do I copy the remaining characters (o World!\n
) in a new line to print out?