C ++错误“函数参数太少”

时间:2012-08-24 16:31:45

标签: c function pointers

我有一个显示错误的C ++程序:

too few arguments to function void split(char*, char**, int, int, int*)

代码:

#include <iostream>
#include <stdlib.h>
using namespace std;

void split(char* lin, char** word, int i, int w, int* c);

int main() {
  char line[80] = "myline";
  int n = 5;
  char **word;
  split(line, word, 1, 1);         //Error is here.

  return 0;
}
void split(char* lin, char** word, int i,int w, int* c)
{
   //statements
}

有人能说出什么错吗?

2 个答案:

答案 0 :(得分:3)

函数split有5个参数,没有默认参数。你试着用4个参数调用它。那不行。

答案 1 :(得分:0)

最后两次你打电话split()你只用4个参数调用它,因为太少了。如果您愿意,您也可以为4个参数定义它,但目前情况并非如此

相关问题