C examples for Operator:Logic Operator
Create a function called larger_of() that replaces the contents of two double variables with the maximum of the two values.
#include <stdio.h> void larger_of(double * x, double * y); int main(void) { double x, y;//from ww w.j a va2 s . co m printf("Enter two numbers x and y: "); while(scanf("%lf %lf", &x, &y) == 2) { printf("Before calling larger_of():\n"); printf("x = %f, y = %f\n", x, y); larger_of(&x, &y); printf("After calling larger_of():\n"); printf("x = %f, y = %f\n", x, y); printf("Enter two numbers x and y: "); } return 0; } void larger_of(double * x, double * y) { // replace contents of if (*x > *y) *y = *x; else *x = *y; }