IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C++ Programming C# Programming Java Programming
Microbiology Biochemistry Biotechnology Biochemical Engineering
Civil Engineering Mechanical Engineering Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C Programming - Functions - Discussion

@ : Home > C Programming > Functions > General Questions - Discussion

Read more:

"Life is like riding a bicycle. To keep your balance you must keep moving."
- Albert Einstein
1. 

The keyword used to transfer control from a function back to the calling function is

[A]. switch[B]. goto
[C]. go back[D]. return

Answer: Option B

Explanation:

The keyword return is used to transfer control from a function back to the calling function.

Example:


#include<stdio.h>
int add(int, int); /* Function prototype */

int main()
{
    int a = 4, b = 3, c;
    c = add(a, b);
    printf("c = %d\n", c);
    return 0;
}
int add(int a, int b)
{
/* returns the value and control back to main() function */
   return (a+b);
}

Output:
c = 7


Klp; said: (Thu, Jan 13, 2011 03:45:25 AM)    
 
Why 0 is there beside return ?

Balasubramanian.P said: (Thu, Mar 31, 2011 08:10:46 AM)    
 
What is return function? how to understant that easily?

Sundar said: (Mon, Jun 13, 2011 12:32:43 PM)    
 
@Klp

The return 0 in the main function transfers the control back to OS (DOS), and denotes that program exits successfully.

It may return 0 for successful completion, -1 to denote error occurred.

From your c program you can call another c program.

Example:

system("mypro.exe") - This function will return 0 on successful completion and -1 on error situation.

Sujatha said: (Mon, Aug 15, 2011 05:51:59 PM)    
 
What is prototype? Explain in detail please.

Vishal said: (Tue, Aug 30, 2011 05:07:35 AM)    
 
If any declearation is not persent in the original pattern then prototype error will occur.

Ex: If you type only print in turboc then it will show you print is a prototype or not specified the header file then also it will come such as if you use getch() without use of the #include<conio.h> header file (in turboc) then it will come getch() is a prototype.

Devdas said: (Sun, Oct 30, 2011 06:07:32 PM)    
 
In simple way, return is a c-keyword used to transfer the control from called function to calling function. It can also use for return a single value.

Rathika.B said: (Wed, Dec 28, 2011 06:45:25 AM)    
 
Please say what is the output of this program?

#include<stdio.h>
#include<conio.h>
void main()
{
int a=1;
printf("\n %d %d %d",a,a++,++a);
getch();
}

Santhosh Kumar said: (Sat, Jan 21, 2012 10:54:51 AM)    
 
@Rathika
a=1
a++=1 //it increment the value after execute the exp
++a=3 //it increment the value before execute the exp

Kruthi said: (Mon, Jan 30, 2012 08:37:31 AM)    
 
How goto works?

Vasavi said: (Fri, Feb 3, 2012 03:51:56 PM)    
 
Goto leads to an unconditional jump in the execution flow of a program's code.

Mahesh Kharvi said: (Mon, Apr 2, 2012 02:05:29 PM)    
 
0 is beside return because the function is integer type it should return integer value.

Tarun said: (Thu, Aug 23, 2012 01:41:47 PM)    
 
We cannot write two arguments in the return statements

ex:
return(x,y);
it will take only 3

Robot said: (Mon, Aug 27, 2012 01:37:20 PM)    
 
Tell me the difference between printf (predefined function) and return (keyword).

R@M said: (Fri, Sep 7, 2012 12:40:16 PM)    
 
Relation between main function and called function is called "PROTOTYPE".

EX:- int add(int, int); /* Function prototype */

Mahesh said: (Fri, Sep 7, 2012 01:47:59 PM)    
 
I think the answer is also may be relating to functions..
and finally what is the out put;
main(){
printf("Mahesh @ SVM");
main();

}

Vinny said: (Wed, Jan 16, 2013 07:30:06 PM)    
 
What is difference between goto, return, go back and switch?

Raji said: (Sat, Mar 9, 2013 10:40:22 PM)    
 
printf function can be used for print the statement and return keyword can be used for return the routine from called function to calling function declaration.

Vignesh said: (Tue, Apr 2, 2013 10:18:02 PM)    
 
Function prototyping is nothing but we are declaring that we have a function in a specific name to the compiler.

Write your comments here:
Name *:     Email:


© 2008-2013 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Contact us: info@indiabix.com     Follow us on twitter!