WHY IS THIS NOT WORKING??? C++
ItsEmpCs (39)

int main() {
std::cout<<"why???";
second();
}
int second() {
std::cout << "NOOOOO";
}

You are viewing a single comment. View All
Answered by SPQR (479) [earned 5 cycles]
View Answer
Zeune (16)

https://repl.it/@Zeune/testing-project here is the project fixed

One thing I did change was the method type from int to void because void is used when we are not returning a value.

void literally means nothing. It is usually used as a function or method return type, when the function isn't supposed to return anything. In the second method you typed out, with the void keyword, it is setting a value, and nothing needs to be returned.

CPPStudent7308 (8)

@Zeune You mean to say I've been wasting my time making functions and always making them return 0? I could have been using void this whole time?