-3
void add (int a, int b)
{
  int c= a+b;
  printf("the value of c is %d",c);
}

void main()
{    
  int x,y;
  printf("Enter two numbers: ");
  scanf("%d %d",&x,&y);
  add (x,y);
}

I understand what function deceleration or prototype is...But which line of code in this program is considered to be a function prototype .....Or there isn't any function prototype in this program???

Bill Lynch
  • 80,138
  • 16
  • 128
  • 173

1 Answers1

0

In your code you did not write the declaration of function at all.

By the way void main() is not correct, always use int main()

// function declaration
void add (int a, int b);

// function definition
void add (int a, int b)
{
   int c= a+b;
   printf("the value of c is %d",c);
}

void main()
{

    int x,y;
    printf("Enter two numbers: ");
    scanf("%d %d",&x,&y);
    // function call
    add (x,y);
}
csavvy
  • 761
  • 4
  • 13