重複の可能性:
C++ のインライン関数の利点?
違いは何ですか
#include <iostream>
using namespace std;
int exforsys(int);
void main( )
{
int x;
cout << "n Enter the Input Value: ";
cin>>x;
cout << "n The Output is: " << exforsys(x);
}
int exforsys(int x1)
{
return 5*x1;
}
と
#include <iostream>
using namespace std;
int exforsys(int);
void main( )
{
int x;
cout << "n Enter the Input Value: ";
cin>>x;
cout << "n The Output is: " << exforsys(x);
}
inline int exforsys(int x1)
{
return 5*x1;
}
これら 2 つの定義は、私が推測するコードでは同じように機能します。インライン関数定義を使用する利点は何ですか?