# I can't believe it......I found a way to multiply 2 pointers!!!!!!

This is a discussion on I can't believe it......I found a way to multiply 2 pointers!!!!!! within the C++ Programming forums, part of the General Programming Boards category; Code: /* Demonstrates inline and multiplying pointers */ #include <iostream> #include <windows.h> inline int ptrmult(int x, int y) { int ...

1. ## I can't believe it......I found a way to multiply 2 pointers!!!!!!

Code:
```/* Demonstrates inline and multiplying pointers */
#include <iostream>
#include <windows.h>

inline int ptrmult(int x, int y)
{
int *ptr, *scd;
ptr= &x;
scd= &y;
return (*ptr)*(*scd);
}

int main(int argc, char *argv[])
{
int a, b, c;
cout << "Input a number: ";
cin >> a;
cout << "Input a number: ";
cin >> b;

c= ptrmult(a, b);
cout << a << " + " << b << "= " << c;
Sleep(c*a*b+100);

cin.get();
return 0;
}

/*
multiplying pointers with just one function

int main(int argc, char *argv[])
{
int x, y;
cin >> x >> y;
int *pointer, *second;
pointer=&x;
second= &y;
cout << (*pointer)*(*second);

cin.get();
return 0;
}

amazing huh?
*/```
To make this topic have a point, rate my coding. Tell me if I could use a better method of performing such an amazing task.

2. execuse me....but i cant c here any amzing thing.all u ve done is just derefrenced the values in the int (which is totally normal thing) and mutliplying it............u didnt multiply the pointers .
or may be just i cant understand it right !!!!

3. I agree that there's nothing special 'bout it. What you actually doing is multiplying to integers and as far as i know, doing that is not one of the hardest tasks. (actually not even a task at all !)

4. hey!!! chillin man the guy just discovered that's also possible to multiply to numbers using pointers(hahaha).