Parsing an array of chars

Let's say I have "" as a string (array of chars) and I want to get the chars that are before the dot. What you would deem to be the most efficient way to do this in C?

Is a "while until . copy char to char" the way to go or is there any other way?

I hope this question can help others also.



you can also use strchr() followed by strncpy() to find first instance of '.' in your string and then copy all characters before it to another string

Need Your Help