answersLogoWhite

0


Best Answer

In C and C++, as well as in many (all?) languages, a function can be called from more than one place in a program. That's the purpose of functions - to encapsulate pieces of code that are needed in more than one place in the program.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

No. You can only have one main() function in c/c++.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can a function be called from more than one place in a program in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How can a called function determine the number of arguments that have been passed to it?

It is not the function but the compiler or interpreter which interprets the code. When the program is compiled and run the compiler checks the entire code line by line to check which function is called. If you encounter polymorphism in other Object Oriented Languages it would be more clear how a function with same name and different arguments are called.


Explain the structure of c program with an suitable example?

Basic structure of a C program is /* Documentation section */ /* Link section */ /* Definition section */ /* Global declaretion section */ /* Function section */ (return type) (function name) (arguments...) void main() { Declaration part Executable part (statements) } /* Sub-program section */ (return type) (function name 1) (arguments...) (return type) (function name 2) (arguments...) . . . (return type) (function name n) (arguments...) Basic structure of a C program is /* Documentation section */ /* Link section */ /* Definition section */ /* Global declaretion section */ /* Function section */ (return type) (function name) (arguments...) void main() { Declaration part Executable part (statements) } /* Sub-program section */ (return type) (function name 1) (arguments...) (return type) (function name 2) (arguments...) . . . (return type) (function name n) (arguments...)


Defining more than one function by the same name is called?

overload


Why you divide a program into functions?

In order to make a large program more manageable, it is convenient to identify and isolate specific tasks that a program performs and to separate out those tasks into functions. These functions are used/invoked as needed by the main part of the program. They can also be invoked by other functions. Often a program will perform the same task in different parts of the program. Using a function to perform the task and invoking the function from the different parts of the program means that only one copy of the code is needed. This helps reduce the size of the program.


What do you call it when your running more than one program?

That is called multitasking.That is called multitasking.That is called multitasking.That is called multitasking.

Related questions

Program defined function c?

function is a self contained block or sub program of two or more statements which performs a special task when called.


Define function in c program?

function is a self contained block or sub program of two or more statements which performs a special task when called.


Does a program exist with more than one main function?

No, it does not.


How can a called function determine the number of arguments that have been passed to it?

It is not the function but the compiler or interpreter which interprets the code. When the program is compiled and run the compiler checks the entire code line by line to check which function is called. If you encounter polymorphism in other Object Oriented Languages it would be more clear how a function with same name and different arguments are called.


Can a function be called from more than one place in aprogram in c plus plus?

You should have tried before asking... of course it can be...


Define multi function in c plus plus?

Multi-function simply means more than one function. Every program must have at least one function, the main function (the entry point of the application), and although you can write an entire program using just this one function, breaking the program down into several smaller functions makes the code easier to read and maintain. A major advantage of multi-function programming is that functions can be called as often as required -- there is no need to write the same piece of code over and over again.


What is the difference between simple program and function in C?

A function is a piece of code that has no or more arguments, that returns no or one value. A program is code that implements the function int main(int argc, char** argv). As such, a function and a program are the same, but the program also includes compiler directives to "include" other things, such as standard headers, i.e. #include .


How do you recognize a function graph?

Assuming that the independent variable (often called "y") is along the vertical axis: to be a function, no vertical line may cross the graph in more than one place.


Can you give more than one main function in the program?

In any source-files, the function names must be unique. In any program (which might be created from multiple source-files), the public function names must be unique.


How do you extract function name from a c program using PERL?

What function do you mean? Any function defined in a source file? Or any function used in a source file? Be more specific.


Can you use more than one function in c language?

Yes And even in the same program!


What is it called when you have more than one program runnning?

It's called multi-tasking.