Module 4 Quiz Question 2 says to call printIt from the main...
And I filled this in and it says it's correct...
cout << "I love C++" << endl;
Now obviously I'm not done the course yet but I'm still curious... If you're meant to use void when you don't know the data type yet, why did they use void instead of char and also, why is main declared to be working with Integers if they're actually strings?
Why does "int main" work when I'm printing non-integers?
There are two functions: main and print
print just output a string and returns nothing, hence the return type is void
main calls print and returns 0 if nothing goes wrong, hence it is an int. It is standard practice for main programs to return 0 if nothing goes wrong, but not always required.
It is sort of like you asking someone to help do something for you, wouldn’t it be nice if you got a confirmation, when that task is done, opposed to checking it yourself?