i have a string name str
i want to put the char's in places 3-6 in another string called st.
how do i do that?
i have a string name str
i want to put the char's in places 3-6 in another string called st.
how do i do that?
is this a string or a char*? you can access the elements in the 'string' by their indices (ie: str[2] = st[0]'). you can overwrite the characters there, but you cant resize the length of your char*
Code:strncpy(st, str+3, 4); st[4] = '\0';