Swap Function - { int d,e; printf("Enter 2 values...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//This program demonstrates a swap function that can be used for sorting, using reference parameters #include <stdio.h> void swap(int *a,int *b) //values enter function: 20,10 exiting function:10,20 { int t; t=*a; *a=*b; *b=t; } void main()
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { int d,e; printf("Enter 2 values "); scanf("%d%d",&d,&e); //user enters 20,10 printf("%d %d\n",d,e); swap(&d,&e); printf("%d %d\n",d,e); } /* Enter 2 values 20 10 20 10 10 20 Press any key to continue . . . */...
View Full Document

This note was uploaded on 10/05/2011 for the course CS 36 taught by Professor Sethhochwald during the Spring '09 term at Irvine Valley College.

Ask a homework question - tutors are online