Q:

error: invalid conversion from ‘int (*)(int, int)’ to ‘int’ [-fpermissive]

I'm trying to create a program with functions that prints the smaller number between two numbers. But when i assign a function to a variable it shows this error:
error: invalid conversion from ‘int (*)(int, int)’ to ‘int’ [-fpermissive]

The code :
#include <iostream>
using namespace std;
int minimum(int num1, int num2){
    int min;
    if(num1 > num2)
        min = num1;
    else
        min = num2;
    return min;
}
int main()
{
    int c{100};
    int d{200};
    int result;
    result = minimum;
    cout<<"The smallest number is " <<result;;
}

And it also shows this error :
error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream’ and ‘’)

It'll be really helpful if you could give me a solution!

A:

That happens because you call the function without any parameters, also min is never created and your function currently checks for maximum number.
#include <iostream>
using namespace std;
int minimum(int num1, int num2) {
    int min;
    if (num1 < num2)
        min = num1;
    else
        min = num2;
    return min;
}
int main()
{
    int c{ 100 };
    int d{ 200 };
    int result = minimum(c, d);
    cout << "The smallest number is " << result;
}

