The INT function is to convert something into an integer. An integer is a number that goes out two decimal places.
typedef float (*pt_func)(int, int); pt_func arr[3];another way:float (*pt_func[3])(int, int);
whatever the variables we declare in function signature to receive the arguments at the calling that are known as parameters.. e.g. int sum(int a,int b); here a & b are known as parameters.....
Nothing: 'auto' is usable only in functions, and there it is the default storage class, so you don't have to use it at all.
return lets you literally return a value from a function. This allows you to define functions like: int add(int x, int y) { return(x + y); } int twoplustwo = add(2, 2);
int sum (int n){if (n
typedef float (*pt_func)(int, int); pt_func arr[3];another way:float (*pt_func[3])(int, int);
#include using namespace std; void swap(int &a, int &b); int main() { int x=5,y=3; cout
whatever the variables we declare in function signature to receive the arguments at the calling that are known as parameters.. e.g. int sum(int a,int b); here a & b are known as parameters.....
void is used by functions that do not return a value. For example: // This function returns an integer, which you can use in other functions int addTwoNumbers(int a, int b) { return(a + b); } // This function does not return a value, so we declare it as a void void printSum(int a, int b) { cout << a << " + " << b << " = " << addTwoNumbers(a, b) << endl; // Note that attempting to return a value here will cause an error. }
Nothing: 'auto' is usable only in functions, and there it is the default storage class, so you don't have to use it at all.
return lets you literally return a value from a function. This allows you to define functions like: int add(int x, int y) { return(x + y); } int twoplustwo = add(2, 2);
Random example, function with two parameters: int main (int argc, char **argv) {...}
#include<stdio.h> #include<conio.h> int arr(int a[]); void main() { int a[10],i; clrscr(); printf("Enter the value for array") for(i=0;i<10;i++) { scanf("%d",&a[i]); } arr(a); getch(); } int arr(int a[10]) { int i; printf("Elements of array\n"); for(i=0;i<10;i++) { printf("\n%d",a[i]); } return 0; }
int sum (int n){if (n
#include<iostream> using namespace std; inline int max(int a,int b) { return (a>b)?a:b; } int main() { int i1=3,i2=5; cout<<endl<<"Inline function says max is "<<max(i1,i2); return 0; } /* Usually when a function is called, the compiler goes to the particular piece of code and executes it. But in the case of inline functions, the code from the body of the function is effectively pasted at the point of call. inline functions are used when the body of the function is only a line or so.*/
sets a variable: volatile int interrupted= 0; void signal_handler (int signo) { interrupted= signo; }
it is the function declared inside the class. It is used for gaining faster speed in execution but it might give back the larger executable fileAn inline function is one that is not called, its code is inserted in the position where you make a call to it. If it is called multiple times from different locations it was be inserted in all locations, increasing the size of all functions its called from but marginally increasing speed.Take this example:inline int AddNumbers(int a,int b){return a+b;}int main(){int x = 2;int y = 3;int answer;answer = AddNumbers(x,y);answer = AddNumbers(answer,y);return 0;}When the program is compiled it would look more like this:int main(){int x = 2;int y = 3;int answer = x+y;answer += y;return 0;}