I want a linked list structure in my VC++ application
My structure is:-
struct xml_data {
int id;
char file_name[50];
char url_source[50];
struct xml_Data *next;
}xml_data1;
If I declare a variable like
struct xml_data *var;
const char* abc;
I want to assign a value from a const char* variable to the structure members.
I tried using
var->file_name=abc;
but it is giving an error that it cannot convert const char* to char[50]…
this may be a small problem but I am very new in using data structures….
After you’ve used new to allocate memory for the struct.
Use
strcpyto copy one to the other.include
<cstring>and make sure there’s enough room in the destination.