pointer in c++
// Variable is used to store value
int a = 5;
cout << a; //output is 5
// Pointer is used to store address of variable
int a = 5;
int *ab;
ab = &a; //& is used get address of the variable
cout << ab; // Output is address of variable
pointer in c++
// Variable is used to store value
int a = 5;
cout << a; //output is 5
// Pointer is used to store address of variable
int a = 5;
int *ab;
ab = &a; //& is used get address of the variable
cout << ab; // Output is address of variable
pointers c++
// pointer to functions
#include <iostream>
using namespace std;
int addition (int a, int b)
{ return (a+b); }
int subtraction (int a, int b)
{ return (a-b); }
int operation (int x, int y, int (*functocall)(int,int))
{
int g;
g = (*functocall)(x,y);
return (g);
}
int main ()
{
int m,n;
int (*minus)(int,int) = subtraction;
m = operation (7, 5, addition);
n = operation (20, m, minus);
cout <<n;
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us