when the linker is trying to link the function call with its definition, it finds the problem and issues the error as “undefined reference”.
#include <iostream>
using namespace std;
int func1();
int main()
{
func1();
}
int func1(int n){
cout<<"hello, world!!";
}
Output:
Wrong definition(signatures don’t match) of objects used, Can somebody please help me solve this? i am literally tried to fix it and it's output is not as i have expected.
@OP It's up to you and your design intention whether the function has an integer parameter. Where an integer might be useful as a parameter is in a function something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
usingnamespace std;
void func1(int);
int main()
{
func1(3);
}
void func1(int x) // function doesn't return anything
{
for(int i = 0; i < x; i++)
cout<<"hello, world!!\n";
}