然后我创建了链表。我修复了一些有关printf的代码,因为,我使用模板,所以我想打印每种类型的所有数据。能否帮我解决此问题?,谢谢。
void PrintAll (string name ){
Node <T> *current =head;
int count=0;
while (current != NULL){
//This code not error
printf("%s[%d]=%d\n",name.c_str(),count,current->data);
//This code error.I don't knows.why ?
printf ("%s[%d] = ",name.c_str(),count);
cout << current->data<<endl;
current=current->next;
count++;
}
}
};
错误:“ printf”没有依赖模板参数的参数,因此“ printf”的声明必须可用[-fpermissive] |