编译错误:solution.c:20:5: Error:期望的标识符或'('在' {' token{之前
Compilation Error: solution.c:20:5: error: expected identifier or ‘(’ before ‘{’ token {
出现意外错误,请帮助解决
/*Program to delete the nth Node from the Linked List*/
见这里的代码片段:
http://pastebin.com/esgv41aC您忘记在这里添加struct
的名称了:
struct{
int data;
struct Node* next;
};
应该是
struct Node {
int data;
struct Node* next;
};
另一个问题是您使用new
,这是一个c++操作符来分配内存。在C语言中,使用malloc
或calloc
来分配内存。不要忘记检查返回值,以检查是否成功分配内存。
,
if (temp1 ==1)
将指针与int
比较。这是错误的。我不知道你到底想干什么
相关文章:
- 如何确保C++函数在定义之前声明(如override关键字)
- 为什么在定义函数之前先声明它
- Arduino:for/while/if在void setup()或void loop()之前?——错误:之前需要不合格
- 程序在执行程序的其余部分之前退出
- 如何将模板转换为C++11之前的模板
- '||'之前的预期主要表达
- (C++)为什么静态成员可以在初始化之前使用
- 标记 '","' 之前的预期主表达式
- C++的解析器在可以区分比较和模板实例化之前会做什么?
- holeMenuProgram.cpp:38:1 错误:'}'令牌之前的预期主表达式
- 错误:在"生成字符串"之前应为";"
- 预计“ [''token之前,预计无限制的ID
- 奇怪的错误:标签'loopend'使用但未定义," if "之前应为非限定 id("goto"和" '}' token "错误相同
- 'token'之前的预期初始值设定项
- 期望')'之前';' token g++
- 编译错误:solution.c:20:5: Error:期望的标识符或'('在' {' token{之前
- 在c++中期望主表达式在token之前
- Arduino错误:* token之前预期的初始化器
- {token c++之前的期望类名
- 在{token之前期望的类名-非常简单