//--------------------------------------------------------------- // EXAMPLE EX15.C : Demonstrate a FUNCTION call - IV. // // Passing POINTERS to access local variable and return multiple // values. // // C.P. Diduch, Dec 1999. //--------------------------------------------------------------- #define KEY_PA 0x138 // 82C55A port addresses for PA, #define KEY_PB 0x13A // PB, #define KEY_PC 0x13C // PC and the #define KEY_CON 0x13E // Control Register. #include // conio.h contains prototypes for // inportb() and outportb(). // Function definitions or prototypes void exchange(char *A, char *B); //--------------------------------------------------------------- void main() { char X, Y; outportb(KEY_CON, 0x82); // Initialize 82C55A PPI with ports // KEY_PC and KEY_PA as OP ports and // port PB as an IP port. X = 5; Y = 10; exchange(&X, &Y); outportb(KEY_PC, X); outportb(KEY_PA, Y); } //--------------------------------------------------------------- void exchange(char *A, char *B) { char tmp; tmp = *A; *A = *B; *B = tmp; }