title: How to pass a pointer to a dynamic array to a void function?
body: <p><B>Updated question to reflect answers and my research</b></p>
  
  <p>Thanks casablanca and wallyk for answering. Success!! I ended up having to edit my strcpy and strcat as well as changing my Displayname(char c_fullname) function and researching some more about the additional errors (both complier and runtime) I was getting, but now I have working code!! Thanks to everyone for your help and patience. My final problem was that I was supposed to write my function declaration and implementation (but not my function call) as "Displayname(char* c_fullname)" not "Displayname(char *c_fullname)". Simple mistake but definitely a costly one as my program was not passing the strings completely. Again thanks to everyne for their help. I know I would have gotten this far without it.</p>
  
  <p>I am posting my completed working code below for anyone else who may have the same issue:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt;
  using namespace std;
  
  void DisplayName(char* c_fullname);
  
  int main()
  {
  //Declaration of variables
  const int n_SIZE = 25;          //Size declaration for first, middle, and last name arrays
  char c_firstname[n_SIZE];       //Firstname array
  char c_middlename[n_SIZE];      //middlename array
  char c_lastname[n_SIZE];        //lastname array
  int n_namesize = 0;             //size declaration for dynamic array
  char *c_fullname;               //pointer for fullname. Later will be allocated an array size
  bool b_test = true;             //while loop test value
  char c_exittest;                //test value for user prompt
  
  //Explanation of program to user
  cout &lt;&lt;"This program inputs a user's first, middle, and last name.\nNext, the names are dynamically allocated to a single array\nand printed to the screen" &lt;&lt;endl &lt;&lt;endl;
  
  while (b_test == true)
  {
      cout &lt;&lt;"Please enter a first name: ";   //User inputs firstname
          cin &gt;&gt;c_firstname;
      cout &lt;&lt;"Please enter a middle name: ";  //User inputs middlename
          cin &gt;&gt;c_middlename;
      cout &lt;&lt;"Please enter a last name: ";    //User inputs lastname
          cin &gt;&gt;c_lastname;
      cout &lt;&lt;endl;                            //endl for aesetics
  
      //Testing of stored variables
      /*
      cout &lt;&lt;c_firstname;
      cout &lt;&lt;c_middlename;
      cout &lt;&lt;c_lastname;
      cout &lt;&lt;endl &lt;&lt;endl;
  
      cout &lt;&lt;strlen( c_firstname ) &lt;&lt;endl; 
      cout &lt;&lt;strlen( c_middlename ) &lt;&lt;endl; 
      cout &lt;&lt;strlen( c_lastname ) &lt;&lt;endl;
      */
  
  
      //setting size of n_namesize for length of array name[]
      n_namesize = (strlen(c_firstname) + strlen(c_middlename ) + strlen( c_lastname ) + 3);   //strlen used to determine length of each element + 3 for spaces
      c_fullname = new char[n_namesize];          //allocates memory to dynamic array 
  
      //Testing of n_namesize
      //cout &lt;&lt;n_namesize &lt;&lt;endl &lt;&lt;endl;
  
      //Concatenating strings to array fullname[n_namesize]
      strcpy_s(c_fullname, n_namesize, c_firstname );     //copies firstname to fullname
      strcat_s(c_fullname, n_namesize, " ");              //concatenates space to fullname
      strcat_s(c_fullname, n_namesize, c_middlename);     //concatenates middlename to fullname
      strcat_s(c_fullname, n_namesize, " ");              //concatenates space to fullname
      strcat_s(c_fullname, n_namesize, c_lastname);       //concatenates lastname to fullname
  
      //Testing of fullname[]
      //cout &lt;&lt;"Name: "&lt;&lt;c_fullname &lt;&lt;endl &lt;&lt;endl;
  
      //Passing pointer of array to function
      DisplayName(c_fullname);
  
      //Prompt users to enter a new name
      cout &lt;&lt;"Do you wish to enter a different name?" &lt;&lt;endl;
      cout &lt;&lt;"Enter 'y' for yes, or 'n' for no" &lt;&lt;endl;
      cin &gt;&gt;c_exittest;
  
      //User wants to enter a new name
      if (c_exittest == 'y')
      {
          delete[] c_fullname;    //deallocates memory assigned to array
      }
  
      //User does not want to enter a new name
      if (c_exittest == 'n')
      {
          b_test = false; //exits while loop
      }
  }
  }
  void DisplayName(char* c_fullname)
  {
  cout &lt;&lt;"The full name entered is: "&lt;&lt;c_fullname &lt;&lt;endl;
  }
  </code></pre>
  
  <p>Hey everyone,</p>
  
  <p>Thanks for your previous help. I have another assignment (past due) that is giving me problems. I think the assignment is to pass a pointer of a dynamic array to a function which then will display the strings. My instructions is to " pass the constructed array to a function called void DisplayName(char * Name)" However, I keep getting errors. My code is:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt;
  using namespace std;
  
  void DisplayName(char *c_fullname);
  
  int main()
  {
  //Declaration of variables
  const int n_SIZE = 25;      //Size declaration for first, middle, and last name arrays
  char c_firstname[n_SIZE];       //Firstname array
  char c_middlename[n_SIZE];      //middlename array
  char c_lastname[n_SIZE];        //lastname array
  int n_namesize = 0;          //size declaration for dynamic array
  char c_fullname[100];           
       //fullname array. size initialy set to 100
  char *c_pointer;                //pointer for dynamic array
  bool b_test;                     //while loop test value
  char c_exittest;                //test value for user prompt
  
  //Explanation of program to user
  cout &lt;&lt;"This program inputs a user's first, middle, and last name.\nNext, the names are dynamically allocated to a single array\nand printed to the screen" &lt;&lt;endl &lt;&lt;endl;
  
  while (b_test = true)
  {
      cout &lt;&lt;"Please enter a first name: ";   //User inputs firstname
          cin &gt;&gt;c_firstname;
      cout &lt;&lt;"Please enter a middle name: ";  //User inputs middlename
          cin &gt;&gt;c_middlename;
      cout &lt;&lt;"Please enter a last name: ";    //User inputs lastname
          cin &gt;&gt;c_lastname;
      cout &lt;&lt;endl;                            //endl for aesetics
  
      //Testing of stored variables
      /*
      cout &lt;&lt;c_firstname;
      cout &lt;&lt;c_middlename;
      cout &lt;&lt;c_lastname;
      cout &lt;&lt;endl &lt;&lt;endl;
  
      cout &lt;&lt;strlen( c_firstname ) &lt;&lt;endl; 
      cout &lt;&lt;strlen( c_middlename ) &lt;&lt;endl; 
      cout &lt;&lt;strlen( c_lastname ) &lt;&lt;endl;
      */
  
      //setting size of n_namesize for length of array name[]
      n_namesize = (strlen(c_firstname) + strlen(c_middlename ) + strlen( c_lastname ) + 3);   //strlen used to determine length of each element + 3 for spaces
      c_pointer = new char[n_namesize];                                                       //allocates memory to dynamic array
      c_pointer = c_fullname;                                                                 //sets pointer to dynamic array     
  
      //Testing of n_namesize
      //cout &lt;&lt;n_namesize &lt;&lt;endl;
  
      //Concatenating strings to array fullname[n_namesize]
      strcpy_s(c_fullname, c_firstname);      //copies firstname to fullname[]
      strcat_s(c_fullname, " ");              //concatenates space to fullname[]
      strcat_s(c_fullname, c_middlename);     //concatenates middlename to fullname[]
      strcat_s(c_fullname, " ");              //concatenates space to fullname[]
      strcat_s(c_fullname, c_lastname);       //concatenates lastname to fullname[]
  
      //Testing of fullname[]
      cout &lt;&lt;"Name: "&lt;&lt;c_fullname &lt;&lt;endl &lt;&lt;endl;
  
      //Passing pointer of array to function
      DisplayName(*c_fullname);
  
      //Prompt users to enter a new name
      cout &lt;&lt;"Do you wish to enter a different name?" &lt;&lt;endl;
      cout &lt;&lt;"Enter 'y' for yes, or 'n' for no" &lt;&lt;endl;
      cin &gt;&gt;c_exittest;
  
      //User wants to enter a new name
      if (c_exittest == 'y')
      {
          delete[] &amp;c_fullname;   //deallocates memory assigned to array
      }
  
      //User does not want to enter a new name
      if (c_exittest == 'n')
      {
          b_test = false; //exits while loop
      }
  }
  }
  
  void DisplayName(char *c_fullname)
  {
  cout &lt;&lt;"The full name entered is: "&lt;&lt;&amp;c_fullname &lt;&lt;endl;
  }
  </code></pre>
  
  <p>my error is: 
  error C2664: 'DisplayName' : cannot convert parameter 1 from 'char' to 'char *'</p>
  
  <p>I have tried to change several parts to make it work, all of which give me other errors. At this point I am really stuck, so looking for some advice. 
  Thanks in advance for your help,</p>
  
  <p>Kula Dhad</p>