repl.it
@anonymous/

TintedGratefulProcedure

C

No description

fork
loading
Files
  • main.c
main.c
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
#include <stdio.h>

typedef float (FuncType)(float, float);

float soma(float a, float b){
    return a+b;
}

float produto(float a, float b){
    return a*b;
}

float operacao( float a, float b, FuncType * pfunc ) {
    return pfunc( a, b );
}

int main(){
    float res;

    res = operacao( 12, 14, soma );
    printf("Soma: %.2f\n", res );

    res = operacao( 12, 14, produto );
    printf("Multiplicacao: %.2f\n", res );

    return 0;
}
?