calling function issue

Im having issues with outputting the doSomething(pX);


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  #include <iostream>

using namespace std;
void doSomething(int *);


void main()
{
	
	int *p;
	int X =10;
	p = &X;
	cout<<p<<endl;
	cout<<*p<<endl;
	cout<<&X<<endl;

	doSomething(pX);  //isnt working in here but works inside the function.

                          

};

		void doSomething(int *pX)
	{
		(*pX)++;
	};
Line 17 should be:
 
    doSomething(p);


Also void main() does not conform to the C++ standard, and should not be used. It should be declared with a return type int:
 
int main()

oh thank you.
Topic archived. No new replies allowed.