challenge.h
#include <stdio.h>
float foo(float F);
float bar(float F);
main.c
#include "challenge.h"
float a = 8.5;
int main() {
float fa = foo(a);
float ba = bar(a);
printf(“%.1f\n”, fa + ba);
return 0;
}
challenge.c
#include "challenge.h"
extern float a;
float foo(float F) {
a = 7.3;
return F * a
}
challenge2.c
#include "challenge.h"
extern float a;
float bar(float F) {
a = 7.5;
float ff = foo(F);
return ff * a;
}
Given the source code above and we use "gcc main.c challenge.c challenge2.c -o challenge" to compile it. What's the output when we type ./challenge
output will be 451.1
Comments
Leave a comment