in my code below:
#include <stdio.h>
#include <stdlib.h>
int main() {
char text[256];
// three character pointers
char *new_line;
// store new_line pointer with hello
new_line = strcpy(text, "hello how are you");
while(*new_line)
printf("%c",*new_line++);
return (0);
}
I am trying to divide the array pointed by *new_line based on the space in between the words stored in the array. more specifically I want to assign index to each word in the array and display it like:
1- hello
2- how
3- are
4- you
How can I break this char array and get these words individually?