/****************************************************************/
/*  C Program Swap A Two Number Through Function                         */
/*  Find more C programs at http://ecomputernotes.com/                   */
/*************************************************************************************/

#include <stdio.h>

//#include <string.h>

void swap (double *d1, double *d2);          

int main ()

            {

            double num1, num2;

            printf("Type in 2 numbers ");

            scanf("%lf%lf", &num1,&num2);

            swap(&num1,&num2);

            printf("\nThe two numbers swapped are %lf, %lf", num1, num2);

            return 0;

            }

void swap (double *d1, double *d2)

            {

            double temp;

            temp=*d1;

            *d1=*d2;

            *d2=temp;

            }

 

Dinesh ThakurDinesh Thakur is a Columinist and designer with strong passion and founder of Computer Notes. if you have any ideas or any request please get @me on
linkedin FaceBook Twitter Google Plus