Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- void swap(int *p, int *q)
- {
- int storage;
- storage = *p;
- *p = *q;
- *q = storage;
- printf("%d , %d", p,q);
- }
- int main(void)
- {
- int a;
- int b;
- printf("Please input a number: ");
- scanf("%d", &a);
- printf("\nEnter another number: ");
- scanf("%d", &b);
- printf("The first variable 'a' will always be shown first. Variable 'b' will follow.\n");
- printf("%d ,", a);
- printf(" %d", b);
- printf("\nNow the two variables' values will be swapped.\n");
- swap(&a,&b);
- printf("\n");
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement