I got first 5 digits that got the course serial number and then the course name i want to split serial number from name to save in a struct for example:
19234 Programming 101
I want to split to:
array[0]=19234
array[1]=programming 101
Thanks.
I got first 5 digits that got the course serial number and then the course name i want to split serial number from name to save in a struct for example:
19234 Programming 101
I want to split to:
array[0]=19234
array[1]=programming 101
Thanks.
Very simple you can use the function strtok() as it mensioned before from barmar. strtok() is a functiont that takes two parametres first you have to insert your string that you want to split and in the second parametre you declare inside in " here " what do you want to split .You can simple use " " for vacuum or commas and etc. example :
int main(){
char s[SIZE]="19234 Programming 101";
char *c; // needs to be pointer
c=strtok(s," ");
printf("%s",c); // it will print this '19234'
return 0;
}