I am just learning to code and am having an issue with a function. Here is the code, and I'll explain below...
#include <stdio.h>
#include <stdlib.h>
void calc(float a, float b);
int main(void)
{
float x;
float y;
printf("This program will calculate ((X-Y)/X*Y\n");
printf("Enter X and Y: ");
while(scanf("%f %f", &x, &y) == 2)
{
calc(x,y); //HERE IS THE ISSUE THE IDE IS POINTING TO
printf("\nEnter X and Y: ");
}
void calc(float a, float b)
{
float answer = (a-b)/a*b;
printf("Answer: %f", answer);
}
}
The issue is with the calc() function, error message during the program build is...
relocation truncated to fit: r_x86_64_pc32 against undefined symbol calc();
What the heck am I doing wrong? It compiles just fine, but I don't understand this problem.
It looks like you're new here. If you want to get involved, click one of these buttons!