Hello!
I am a new c leaner.
Can I call a function from a different function apart from the main ?
And is this also part of recursive?

Recommended Answers

All 3 Replies

You can call a function from anywhere.

You can call a function from main and this function inside it's body can call other functions. Those other functions can also call functions. This is how you build up complex applications.

A recursive function is one that calls itself. This is often used for things like traversing a directory structure or things of that nature.

There are many good tutorials on this.

Check out the following for example.

http://www.zentut.com/c-tutorial/c-recursive-function/
http://www.programiz.com/c-programming/c-recursion
http://www.cprogramming.com/tutorial/lesson16.html

Hope that helps.

What Dave said, plus, recursion also occurs when functionA calls functionB ... and finally functionX calls functionA again, before any of them return to their caller. These function stacks can become very deep, and difficult to debug.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.