forked from Varshini98/git-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswap.c
More file actions
33 lines (25 loc) · 620 Bytes
/
swap.c
File metadata and controls
33 lines (25 loc) · 620 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*********
Author1 Name:
Author2 Name:
FIXED THE BUGS FOR GIT-WORKSHOP
**********/
// THERE ARE NO BUGS IN THIS PROGRAM. HAPPY NOW :P
#include <stdio.h>
void swap(float *ptr1, float *ptr2);
void main()
{
float m, n;
printf("Enter the values of M and N \n");
scanf("%f %f", &m, &n);
printf("Before Swapping:M = %5.2ftN = %5.2f\n", m, n);
swap(&m, &n);
printf("After Swapping:M = %5.2ftN = %5.2f\n", m, n);
}
/* Function swap - to interchanges the contents of two items */
void swap(float *ptr1, float *ptr2)
{
float temp;
temp = *ptr1;
*ptr1 = *ptr2;
*ptr2 = temp;
}