3 years ago
in English ยท 1,804 Views
likes 3clips 3comments 0
Function Declarations in C++
Functions cannot be called before they are declared. Super important to remember. Your declaration should include all types and use the same syntax as the function definition, but you end it with a semicolon. In my example, I am doing a super simple function called sum, where I find the sum of two integers. I would declare it first as: int sum(int x, int y); And then, below main, I would write the function definition: int sum(int x, int y){ return x+y; }
csgeek clipped in 1 collections