I have 3 functions:
- First function takes an int a and prints the that number of dots.
- The second function takes an int b and prints that number of stars.
- The third function takes a and b and calls the dots function and stars function. When I call it in main, it returns 0 without any output.
Each of the functions work fine on their own - why doesn't the third one work then?
EDIT: Tried initializing i=0, code still compiles with the same result. Again, both functions dots() and stars() work fine when called on their own.
void dots(int a){
for(int i; i<a; i++){
cout << ".";
}
}
void stars(int a){
for(int i; i<a; i++){
cout << "*";
}
}
//(not working):
void dotsstars(int a, int b){
dots(a);
stars(b);
}
int main(){
dotsstars(5, 6);
return 0;
}