A: 

To fix, replace

DisplayName(*c_fullname);

with

DisplayName(c_fullname);

c_fullname is already a pointer type. Putting * in front of it dereferences it providing the contents of the element, which is type char.

By the way, deleting &c_fullname—or anything else associated with c_fullname—will cause nasty runtime problems. There is no need to delete an automatic array.

wallyk
Ok, now I get the error: error C2664: 'DisplayName' : cannot convert parameter 1 from 'char [100]' to 'char'
Kula Dhad
Also, I am supposed to deallocate the memory assigned to the array. my instructions say:// pass dynamic array to DisplayName(char *) function for displaying // Deallocate dynamically-allocated array
Kula Dhad
thanks for answering my question so quickly btw.
Kula Dhad
Disregard my comments, I misread and did not fully implement your answers. I now have a different problem (as indicated in my updates above). Thanks for your help
Kula Dhad
I got it working! thanks for your help
Kula Dhad
+2  A: 

You've got the use of * and & mixed up. You don't need any operator to pass a pointer, you just pass it directly. This:

DisplayName(*c_fullname);

should be:

DisplayName(c_fullname);

Again, a char * is already a string, so you can print it directly. & takes the address, which is not what you want. This:

cout <<"The full name entered is: "<<&c_fullname <<endl;

should be:

cout <<"The full name entered is: "<<c_fullname <<endl;

Finally, you should NOT delete memory that wasn't allocated using new. In your case, c_fullname was allocated on the stack, so you should remove this line:

delete[] &c_fullname;

Update: Maybe I wasn't clear earlier. The function is still defined to take char *:

void DisplayName(char *c_fullname);

But you just call it as:

DisplayName(c_fullname);

pass dynamic array to DisplayName(char *) function for displaying and Deallocate dynamically-allocated array

To do this, you just get rid of your existing static array (char c_fullname[n_SIZE]) and use new to create the array. In that case, you will also need to use delete later:

char *c_fullname;
...
c_fullname = new char[n_SIZE];
...
DisplayName(c_fullname);
...
delete [] c_fullname;
casablanca
thanks for answering so quickly, but now I get the error: error C2664: 'DisplayName' : cannot convert parameter 1 from 'char [100]' to 'char' Also, my instructions say to "pass dynamic array to DisplayName(char *) function for displaying and Deallocate dynamically-allocated array" so how would I do this safely?
Kula Dhad
I've updated my answer.
casablanca
Disregard my reply, I misread your answer the first time. I now have a different problem as indicated in the updates above. Thanks for your help.
Kula Dhad
I got it working! Thanks for your help
Kula Dhad