Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

lignin

Junior Member level 2
Junior Member level 2
Joined
Apr 27, 2013
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top