C编程出错:not in formal parameter list
#include<stdlib.h>#include<stdio.h>#include<string.h>#include"protocol.h"#include"dat...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "protocol.h"
#include "datalink.h"
#define DATA_TIMER 2000
#define MAX_SEQ 7
//PKT_LEN只是数据长度, packet也只含数据部分,数据链路层加上三个帧头信息,物理层加上4CRC
//typedef enum{false,true} boolean;
//typedef unsigned int seq_nr;
typedef struct {unsigned char data[PKT_LEN];}packet; //packet buffer[]:相当于二维数组
//typedef enum{data,ack,nak}frame_kind;
struct FRAME {
packet info;
unsigned char kind; /* FRAME_DATA */
unsigned char ack;
unsigned char seq;
// unsigned char data[PKT_LEN];
unsigned int padding; //位填充
};
static unsigned char frame_nr = 0;
//static unsigned char frame_expected = 0;
static int phl_ready = 0;
static int betw(unsighed char a,unsighed char b,unsighed char c)
{
if(((a<=b)&&(b<c))||((c<a)&&(a<=b))||((b<c)&&(c<a)))
return 1;
else
return 0;
}
就是在这行:static int betw(unsighed char a,unsighed char b,unsighed char c)
error C2143: syntax error : missing ')' before 'type'
F:\计网试验\datalink.c(32) : error C2085: 'a' : not in formal parameter list
F:\计网试验\datalink.c(32) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(32) : error C2085: 'b' : not in formal parameter list
F:\计网试验\datalink.c(32) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(32) : error C2059: syntax error : ')'
F:\计网试验\datalink.c(33) : error C2085: 'c' : not in formal parameter list
F:\计网试验\datalink.c(33) : error C2143: syntax error : missing ';' before '{'
F:\计网试验\datalink.c(34) : error C2065: 'a' : undeclared identifier
F:\计网试验\datalink.c(34) : error C2065: 'b' : undeclared identifier
F:\计网试验\datalink.c(34) : error C2065: 'c' : undeclared identifier
F:\计网试验\datalink.c(83) : error C2065: 'unsighed' : undeclared identifier
F:\计网试验\datalink.c(83) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(84) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(85) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(86) : error C2275: 'packet' : illegal use of this type as an expression
F:\计网试验\datalink.c(15) : see declaration of 'packet'
F:\计网试验\datalink.c(86) : error C2146: syntax error : missing ';' before identifier 'buffer'
F:\计网试验\datalink.c(86) : error C2065: 'buffer' : undeclared identifier
F:\计网试验\datalink.c(86) : error C2109: subscript requires array or pointer type
F:\计网试验\datalink.c(87) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(88) : error C2143: syntax error : missing ';' before 'type' 展开
#include <stdio.h>
#include <string.h>
#include "protocol.h"
#include "datalink.h"
#define DATA_TIMER 2000
#define MAX_SEQ 7
//PKT_LEN只是数据长度, packet也只含数据部分,数据链路层加上三个帧头信息,物理层加上4CRC
//typedef enum{false,true} boolean;
//typedef unsigned int seq_nr;
typedef struct {unsigned char data[PKT_LEN];}packet; //packet buffer[]:相当于二维数组
//typedef enum{data,ack,nak}frame_kind;
struct FRAME {
packet info;
unsigned char kind; /* FRAME_DATA */
unsigned char ack;
unsigned char seq;
// unsigned char data[PKT_LEN];
unsigned int padding; //位填充
};
static unsigned char frame_nr = 0;
//static unsigned char frame_expected = 0;
static int phl_ready = 0;
static int betw(unsighed char a,unsighed char b,unsighed char c)
{
if(((a<=b)&&(b<c))||((c<a)&&(a<=b))||((b<c)&&(c<a)))
return 1;
else
return 0;
}
就是在这行:static int betw(unsighed char a,unsighed char b,unsighed char c)
error C2143: syntax error : missing ')' before 'type'
F:\计网试验\datalink.c(32) : error C2085: 'a' : not in formal parameter list
F:\计网试验\datalink.c(32) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(32) : error C2085: 'b' : not in formal parameter list
F:\计网试验\datalink.c(32) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(32) : error C2059: syntax error : ')'
F:\计网试验\datalink.c(33) : error C2085: 'c' : not in formal parameter list
F:\计网试验\datalink.c(33) : error C2143: syntax error : missing ';' before '{'
F:\计网试验\datalink.c(34) : error C2065: 'a' : undeclared identifier
F:\计网试验\datalink.c(34) : error C2065: 'b' : undeclared identifier
F:\计网试验\datalink.c(34) : error C2065: 'c' : undeclared identifier
F:\计网试验\datalink.c(83) : error C2065: 'unsighed' : undeclared identifier
F:\计网试验\datalink.c(83) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(84) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(85) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(86) : error C2275: 'packet' : illegal use of this type as an expression
F:\计网试验\datalink.c(15) : see declaration of 'packet'
F:\计网试验\datalink.c(86) : error C2146: syntax error : missing ';' before identifier 'buffer'
F:\计网试验\datalink.c(86) : error C2065: 'buffer' : undeclared identifier
F:\计网试验\datalink.c(86) : error C2109: subscript requires array or pointer type
F:\计网试验\datalink.c(87) : error C2143: syntax error : missing ';' before 'type'
F:\计网试验\datalink.c(88) : error C2143: syntax error : missing ';' before 'type' 展开
3个回答
展开全部
眼神儿需要犀利,单词打错了,unsigned...不是unsighed。。。仔细检查下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
static int betw(unsighed char a,unsighed char b,unsighed char c)
改为
static int betw(unsigned char a,unsigned char b,unsigned char c)
改为
static int betw(unsigned char a,unsigned char b,unsigned char c)
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
....有点多啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询