answersLogoWhite

0

Calling a function from switch in C?

Updated: 12/24/2022
User Avatar

Wiki User

14y ago

Best Answer

Yes, you can call a function from within a switch statement in C.

switch (i) {

case 0: function1(i); break;

case 1: function2(i); break;

default: function3(i); break;

}

When the function returns, you will still be in the switch statement.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Calling a function from switch in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Who is calling main function in c?

in c main function initailly called by operating system.


When calling a function that has multiple parameters can you list the arguments in any order?

No. C function argument are positional.


What is the function of visual c plus plus switch condition?

The switch / case statement.


How do you add two numbers with out using operator in c language?

Not possible. Of course you can call a function which does the addition for you, but function-calling is also an operator in C.


How switch function differs from user defined functions in C?

. please give me 3 or 4 differences.one difference is that user defined can be called anytime but not for switch There is no such thing as 'switch function'


What is the meaning of x.getdata in c plus?

it mens u r calling de member function of de program


Why you use void res in c programming?

since, the word 'void' in C programming language means that it does not return any value to the user or calling function....this is usually used to specify a type of function...... for this reason w use 'void'in c program..


How are input and output functions are accessed in C programming?

The most common way to invoke an input/output function is calling it by its name. Example with function puts:puts ("Hello world");


What is the function of changeover switch?

Function Of Change Over Switch


What is the function of a switch?

The function of a switch is to break and connect the flow of electricity.


What is calling by reference?

In C++ (C Plus Plus), when you call by reference, you are directly accessing the data of the referenced object. When you pass an object to a function by reference, any and all alterations to the object made within the function carry through to the actual object.


What switch performs a control function?

Every switch performs a control function. On / Off is a control function.