void swap (int *first, int *second)
{
  int temp = *first;
  *first = *second;
  *second = temp;
}

int main ()
{
  int i = 5, j = 6;
  swap (i, j);
  printf ("i=%d j=%d\n", i, j);
}

warning:

[37] $ gcc -o ex321 ex321.c
ex321.c: In function `main':
ex321.c:14: warning: passing arg 1 of `swap' makes pointer from integer without a cast
ex321.c:14: warning: passing arg 2 of `swap' makes pointer from integer without a cast

Add -Wall option when you compile. (ignore!!_

Sorry another brain fart. You need to pass the address of the parameters to your swap function like so:

swap (&i, &j);

Thank you!!! I also had forgot to return something in main().

Problem Resolved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.