Search Results

Search found 1 results on 1 pages for 'user105439'.

Page 1/1 | 1 

  • Function not returning value at all - not a void [migrated]

    - by user105439
    I have this function that is not returning a function value. I've added some random testers to try and debug but no luck. Thanks! #include <stdio.h> #include <math.h> #include <time.h> #define N 100 float error(int a, int b); int main(){ printf("START\n"); srand(time(NULL)); int a, b, j, m; float plot[N+1]; printf("Lower bound for x: "); scanf("%d", &a); printf("Upper bound for x: "); scanf("%d", &b); printf("okay\n"); for(j = 0; j < N; j++) plot[j] = 0; printf("okay1\n"); m = error(a,b); printf("%f\n",m); return 0; } float error(int a, int b){ float product = a*b; printf("%f\n",product); return product; } so the m = error(a,b) always gives 0 no matter what! Please help. I apologise for not cleaning this up...

    Read the article

1