No, the arrays (gfg and tok) will be destroyed automatically when they go out of scope.
I am worried If I am doing it right
It is correct for the example that you have shown, but it won't work correctly of the string can contain more than 50 tokens. The reason I mentioned counting the number of tokens first was so that you could know how large array you should create. If the array always have the same size you don't really need to do so. You could just call strtok until it returns null. You might also want to add a check that makes sure you don't go out of bounds in case there are more tokens than array elements.
Also note that array indices start at 0 so in your code you are not making use of the first element in the tok array which means you only have room for 49 tokens instead of 50.
char gfg = "name1,, name3";
If you had this, would you expect to see an empty field?
char gfg = "\"Flintstone, Fred\",\"Rubble, Barney\"";
If your strings are coming from a CSV file, you're likely to run into all sorts of trouble over simple use of strtok.
Commas embedded inside fields will trip you up. https://en.wikipedia.org/wiki/Comma-separated_values
anyway, the very simple way to do this is one loop, all in one:
copy the original string into a c-string, letter by letter.
while copying: set the first char* for the first string to the address of the first letter of the copy destination.
if the letter is a comma, replace it with a zero and set the next char* to the address of the next letter...
this would be easier if the char*s were an array or vector, not named entities. If you need to name them, name the index
stringvar[thefirststring] or the like...
the whole thing is like 1/4 the size of the strtok approach above in size and complexity. Its reinventing the wheel which is bad but its rolling the copy, pointer assignment, token splitting and all into a single loop.