Darn, doesn't seem to apply to C++, though.
Printable View
Darn, doesn't seem to apply to C++, though.
This is your code
[code]
#include "stdio.h"
void swap(int *, int *);
int main()
{
int c,d;
printf( "\nEnter c value:" );
scanf( "%d", &c );
printf( "\nEnter d value:" );
scanf( "%d", &d );
swap(&c, &d);
printf("\nc=%d", c);
printf( "\nd=%d", d);
return 0;
}
void swap(int *p, int *q)
{
int temp;
temp=*p;
*p=*q;
*q=temp;
}
[\code]
Actually, I think, [\code] should be [/code] here.