-
-
Save fahadcprogramming/9b392cf6896da2c5e5aeb6016a2d7c04 to your computer and use it in GitHub Desktop.
Addition of pointers in c++ code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int Sum(int *, int *); | |
float Sum1(int *,int *); | |
double Sum2(int *, int *); | |
int main() | |
{ | |
int a,b; | |
cout<<"Enter 1st Value:"; | |
cin>>a; | |
cout<<"Enter 2nd Value:"; | |
cin>>b; | |
cout<<"...............ADDITION.............." <<endl <<endl; | |
cout<<"The integer sum of these numbers is:"<<Sum(&a,&b)<<endl; | |
cout<<"The float sum of these numbers is:"<<Sum1(&a,&b)<<endl; | |
cout<<"The double sum of these numbers is:"<<Sum2(&a,&b)<<endl; | |
cout<<endl <<endl; | |
cout<<endl <<endl; | |
return 0; | |
} | |
int Sum(int *x, int *y ) | |
{ | |
int sum; | |
sum=(*x + *y); | |
return sum; | |
} | |
float Sum1(int *x,int *y ) | |
{ | |
float sum; | |
sum=(*x + *y); | |
return sum; | |
} | |
double Sum2(int *x, int *y ) | |
{ | |
double sum; | |
sum=(*x + *y); | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pointer addition in c++
This code has been tested on codeblocks c++ compiler
find more explanation here program source c++ pointer addition
C++ source code to add two pointers find more examples at
C++ programs examples