I found a program which uses different parameters in function prototyping and declaring, so I made a basic program.
#include <iostream>
using namespace std;
void add(int a, int 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"?
Yes, the name of parameters used in declaration and definition doesn't have to be the same. Instead, the type of parameters (and order), should be the same. In fact, parameter names are not necessary especially in function declaration, even in definition they also could be omitted if you don't use them.
[dcl.fct]/13:
(emphasis mine)
And [dcl.fct]/8:
Note that the parameter-type-list, not including their names, is part of the function type.