I mean if I have :
how can i copy the string from str 5-8 char to str_temp?Code:char* str_temp; str = "bla cla dla ela";
Thanks!
I mean if I have :
how can i copy the string from str 5-8 char to str_temp?Code:char* str_temp; str = "bla cla dla ela";
Thanks!
Well str_temp needs some memory allocated to it to begin with.
Say
str_temp[30];
Then you can do things like this
strncpy(str_temp,&str[5],3);
str_temp[3] = '\0';
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Thanks.