I have the below array,
struct Student{
char* Name;
int age;
Student* Next;
};
And i used to follow the below steps to access the char* fields.
Method 1;
Student s1 = {strdup("Name1"),26};
Method2:
Student s2;
s2.Name = strdup("Name2");
s2.age = 26;
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?.
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 )
My ultimate Aim is to have a data structure correctly with best access methodology. pls Help!!!
struct DataStruct{
(char*/char [] / string) Name; // Need a best way
}
also the access mechanism.
if we have only three mechanisms like char* , char [] and string, then please advise the best way of accessing them from int main().
Many Thanks