return 0 in function

How do you return 0; in a function?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>

using namespace std;

int a(){
  cout<<"hi";
  return 0;
}

int main(){
  while(true){
    a();
  }
}


This code doesn't stop running. How can I make it stop?
10
11
12
13
14
int main(){
  while(true){
    return a();
  }
}
closed account (jvqpDjzh)
line 11: How can your loop stop, if the codition never changes?
Maybe you mean this: while( a() );
Last edited on
Thank you so much people! The problem is solved!
Topic archived. No new replies allowed.