How many times do you need to be told that you can't do this?
1 2 3
|
char temp[100] = {null};
...
temp[100] = null; // This is just plain wrong, wrong, wrong!
|
Arrays in C start at zero and stop at size - 1. When you try to access the array[size] you are accessing the array out of bounds!
Next this should be giving you a warning if not an error:
len = strlen(temp);
You haven't #included the correct header file to use this C standard function.
Next you can't do this with C-strings.
names[i] = temp; // This does not do what you think.
You can't use the assignment operator, or any of the comparison operators (==, !=, >, <, etc) with C-strings. You need to use one of the functions prototyped in the <cstring> header. When you use the assignment operator you're changing the pointer, not the contents. And when you change the pointer you have created a memory leak because you loose the pointer that you created with the dynamic memory.
Lastly while you tried to delete the memory you allocated for the strings, you forgot to delete the memory you allocated for the pointers.