If you want to create you function in main(), then there is no difference for creating function in C or C++; Now, if you want to create your function in class, (c++)
#include<iostream.h>
class sample
{
public:
int a,b;
int sum(int x,int y)
{
return x+y;
}
};
main()
{
sample o1;
int result;
o1.a=10;
o1.y=20;
result = o1.sum(a,b);
cout << "sum = " << result;
}