I want to assign a value to my char * like that:
char *text;
struct node *ptr = head;
//start from the beginning
while(ptr != NULL)
{
text = ptr->key + ";" + ptr->data + ";\n";
ptr = ptr->next;
fprinft(f, text);
}
The key value is a char[] and the data value an int.
I get the following error:
Error: invalid operands to binary + (have ‘int’ and ‘char *’) text = ptr->key + ";" + ptr->data + ";\n";
Does anyone know how to fix that problem?