c - Too few arguments to call -


my teacher isn't willing me error don't know else go. on line 19, addition();, error says there few arguments in function call , i'm not sure why is. beginner programmer, have called functions before i'm not sure why getting problem now.

#include <stdio.h>  int addition(int *change);  int main(void) {     int num = 10;     printf("name \t address \t value\n");     printf("%s \t %p \t %d\n", "num", &num, num);      int *change = &num;     printf("change:  %p\n", change);      *change = 100;     printf("the value of num %d \n", num);     printf("the value of change %d \n", *change);      addition();      return 0; }  int addition(int *change) {     int input;     int result = input + *change;      printf("input value ");     scanf("%d", &input);      printf("the result change (%d) + input (%d)\n", *change, input);     printf("result: %d", result);      return 0; } 

perhaps better suited comment, lack required reputation post comments...

when you're calling function, have supply information. if walked , commanded "add!" might reply "what should add?" error message telling you. you're issuing command, you're not giving enough information complete command.

you can find additional information required function glancing @ declaration. in case, function declaration is:

addition(int *change) 

meaning that, in order function properly, function requires pointer integer (int *). every time call addition function, have supply argument function knows number expected add.


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -