char* is not a string. Wipe this out of your mind. Pointers and strings are two very different things.
You only have 1 actual string here (or really, you have one char buffer), and that buffer is 'firstName'. You also have tempArr, but you don't seem to be using it.
You then have 'clients', which are 25
pointers (read: not strings). You then do this:
clients[count]=firstName;
, which tells clients[count] (read: a pointer, not a string) to point to 'firstName'.
Ultimatley what is happening is all of your clients end up pointing to firstName. So whenever firstName changes, all of them appear to change because they're all accessing the same data.
The easy solution here is to use std::string:
1 2 3 4 5
|
#include <string>
...
string clients[25];
...
clients[count] = firstName;
|
But since you seem to be more of a C man, rather than C++, the C alternative would be to use char buffers and strcpy:
1 2 3
|
char clients[25][20]; // 25 buffers, each 20 characters wide
...
strcpy( clients[count], firstName );
|