// 31.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
using namespace std;
void fun(int *p, int *q)
{
int tmp = *p;
*p = *q;
*q = tmp;
}
int main(int argc, char* argv[])
{
int a,b;
cin>>a>>b;
fun(a,b);
cout<<a<<' '<<b<<endl;
return 0;
}
Compiling...
31.cpp
F:\test\31\31.cpp(18) : error C2664: 'fun' : cannot convert parameter 1 from 'int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.