[SOLVED] too few arguments to function `void function(per*, int)' problem

Status
Not open for further replies.

lignin

Junior Member level 2
Joined
Apr 27, 2013
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,436
hello ;
I have a problem with the following code.
Code:
#include<stdio.h>
#include<string.h>
#include<conio.h>

typedef struct person {
        
        char name[20];
        int age ;
           
}per;

void function(per *pointer, int newAge){// problem is here.
     pointer->age = newAge;
}


int main(){
      per per1;
      function(&per1);
      printf("age %d",per1.age);
      getch();
}

I received following error : 12 C:\Dev-Cpp\Untitled1.cpp too few arguments to function `void function(per*, int)'

so what is the problem ?
thanks for your answer.
 

you define the function with two parameters
Code:
void function(per *pointer, int newAge){// problem is here.

but only call it with one
Code:
      function(&per1);

it needs two parameters, e.g.
Code:
      function(&per1, 10);
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…