Functions

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

A switch

B goto

C go back

D return

ANS:A - switch

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



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.