我有这个包含文件(内存.h)
#ifndef MEMORY_H #define MEMORY_H #ifdef __cplusplus extern "C" { #endif typedef struct mmemory { int* cells; int* current_cell; int cells_number; } memory; void memory_init(memory* mymemory,int size); void step_left(memory* mymemory,int steps); void step_right(memory* mymemory,int steps); void cell_inc(memory* mymemory,int quantity); void print_cell(memory* mymemory); void get_char(memory* mymemory); #ifdef __cplusplus } #endif #endif /* MEMORY_H */
而这个实现文件(memory.c)
#include <stdlib.h> #include "memory.h" void memory_init (memory* mymemory,int size) { mymemory->cells = (int*) malloc (sizeof (int) * size); mymemory->cells_number = size; mymemory->current_cell = (int*) ((mymemory->cells_number / 2) * sizeof (int)); } ... //other function deFinitions follow
src/memory.c:5: error: expected ‘)’ before ‘*’ token
其中第5行是memory_init()的函数定义
有人可以告诉我为什么我收到此错误?
解决方法
原文地址:https://www.jb51.cc/c/116697.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。