title: How to access an array inside a struct in c/c++
body: <p>I have the below array,</p>
  
  <pre><code>struct Student{
  char* Name;
  int age;
  Student* Next;
  };
  </code></pre>
  
  <p>And i used to follow the below steps to access the char* fields.</p>
  
  <p>Method 1;</p>
  
  <pre><code>Student s1 = {strdup("Name1"),26};
  </code></pre>
  
  <p>Method2:</p>
  
  <pre><code>Student s2;
  s2.Name = strdup("Name2");
  s2.age  = 26;
  </code></pre>
  
  <p>Here i wanted to know is there any other way to access the char* Field and if not is there a specific and best way to access  char* fields?.</p>
  
  <p>Also what is the best way to have a datastructure like name, address and etc.. inside a struct. should i go with the above method char*? or can i have array instead? or string will make sense in this?(is there any other method is available instead of char*. char array[], string stringname )</p>
  
  <p>My ultimate Aim is to have a data structure correctly with best access methodology. pls Help!!!</p>
  
  <pre><code>struct DataStruct{
  (char*/char [] / string) Name; // Need a best way 
  } 
  </code></pre>
  
  <p>also the access mechanism.</p>
  
  <p>if we have only three mechanisms like char* , char [] and string,
  then please advise the best way of accessing them from int main(). </p>
  
  <p>Many Thanks</p>