Let’s say I have “game.abc” 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.
Thanks!
you can also use
strchr()followed bystrncpy()to find first instance of ‘.’ in your string and then copy all characters before it to another string