static
Program 1: #include <stdio.h> int a, b =0; void prtFun (void); int main (){ static int a = 1; /* line 1 */ prtFun(); a++; prtFun(); printf ("Inside main, a is %d and b is %d\n" , a, b); } void prtFun (void){ static int a...
Search for a command to run...
Series
Program 1: #include <stdio.h> int a, b =0; void prtFun (void); int main (){ static int a = 1; /* line 1 */ prtFun(); a++; prtFun(); printf ("Inside main, a is %d and b is %d\n" , a, b); } void prtFun (void){ static int a...
Program: void swap(int*,int*); int main() { printf("Enter two numbers : "); int a,b; scanf("%d%d",&a,&b); printf("\n Before swapping, a and b are: %d and %d",a,b); swap(&a, &b); printf("\n After swapping, a and b are: %d and %d",a,b); } ...
A recursive function is defined in terms of base cases and recursive steps. In a base case, we compute the result immediately given the inputs to the function call. In a recursive step, we compute the result with the help of one or more recursive c...
A function can have multiple return statements. A recursive function has multiple return statements, for example, associated with conditional statements like if-else . long long int factorial(int n){ if (n==0) return 1; return n*factorial(n-1...
An ellipsis ... is used to represent a variable number of parameters to a function. Program: void function(int arg1, ...){ printf("The argument is : %d", arg1); } int main(){ function(1,2,3); function(2,5,7,7,9); } Output:
#include <stdio.h> // The following function subtracts two numbers int subtract(int a, int b) { return a - b; } int add(int a, int b) { return a + b; } int main() { // The command declares function pointers int (*functionPtr)(int, int); f...