I am learning C++ and I want to run a method, it doesn't have a return type or need any params passed to it. It just "does the work" from my main method. The issue I am having is it is int32 and not a void method. How would I call this method?
1 2 3 4 5 6 7
int main(int argc, char *argv[])
{
DOMath();
}
int32_t DOMath() {
//Code here
}
You can call the function just as you did in line 3, unless you need to deal with the returned value from the function. Then you do as Handy Andy as done.
You need to return some value in your function since you specified a return type. Even if the returned value is just some junk value, such as zero.