Different variable in function prototype

0 Athul S Nair · August 29, 2016

Hi,

     I found a program which uses different parameter in function prototyping and declaring   , so i made a basic program.
#inlcude <iostream>
using namespace std;

void add(int a, it b);

int main()
{
add(3,4);
}

void add(int c, int d){
int e = c + d;
cout << e << endl;
}


I run this program and it works. Does that mean it isn't necessary to same parameter name in both "function prototyping" and in  "function declaring"


Thanks

Post a Reply

Replies

Oldest  Newest  Rating
+1 Scott Walker · August 30, 2016
Not as far as I'm aware, pretty sure you don't have to put a variable into the prototype, you could just state the type as int, int
  • 1

C++

131,221 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator