I am trying to give a value of char array field of a struct to an an element of another struct array.
struct Node {
char template_id[6];
};
struct Node1
{
char *template_id;
}
void main()
{
Node1 *temp;
temp_counter=0;
temp=malloc(5*sizeof(Node1));
temp[temp_counter].template_id=cur_node->template_id; //getting seq error here
}
Tried the followings:
strcpy(temp[temp_counter].template_id,cur_node->template_id);
strncpy(temp[temp_counter].template_id,cur_node->template_id,6);
Still seq error.
cur_node
is initialized in different place and it is ok.
Tried the following:
temp[temp_counter].template_id="hello"; // It works though