Chris
Chris

Reputation: 1

Calling a function to another function vise versa in C

If I have a function called

void do1(int input)

{
do2(1);
}

and

void do2(int input)
{
do1(2);
}

right under eachother, is there a way for do1 function to call do2 function?

Upvotes: 0

Views: 42

Answers (1)

Manny_Mar
Manny_Mar

Reputation: 398

Just put a function declaration above

void do2(int input);

then:

void do1(int input)

{
  do2(1);
}

void do2(int input)
{
  do1(2);
}

And it will work.

Upvotes: 2

Related Questions