tags:

views:

196

answers:

1
#include "stdio.h"
#include "conio.h"

void swap(int *x,int *y);

void main()
{
int a=10,b=20;
swap(a,b);
printf("value of a=%d and b=%d");
getch();
}

void swap(int *x,int *y)

{
  if(x!=y)
     {
      *x ^= *y;
         *y ^= *x;
         *x ^= *y;

     }
}

// I'm getting .. cann't convert int to int * ...

can anybody tell me why so . and how to solve it regards.

hoping for quick and positive response.

+17  A: 

Your call to swap() should be swap(&a,&b);

Graham Perks
Yes, just what i was gonna say, so +1
Richard J. Ross III
doc
@doc: This is not true for C, which is also one of the tags (just to be complete and pedantic)
Nathan Fellman
I think the _correct_ solution to the whole delimma is for people to actually *decide what language they are using*. Contrary to popular belief, C code is _not_ the same as C++ code.
mathepic