ok.. this is the code that i've makes some corrections..
Code:
#include <stdio.h>
void loan_calculate (float L, float DP, int Y, float S, float *monthlyPtr, char *statusPtr, float I);
int main ()
{
float L, DP, S, I, monthly;
int Y;
printf("LOAN ADVISOR\n");
printf("Car purchase price/loan <RM>: \n");
scanf("%f", &L);
if (L < 50000)
I == 4.0;
else if (L < 100000 && L >= 50000)
I == 3.5;
else if (L >= 100000)
I == 3.0;
printf("Down payment <RM>: \n");
scanf("%f", &DP);
printf("Payment period <in year>: \n");
scanf("%d", &Y);
printf("Monthly salary: \n");
scanf("%f", &S);
loan_calculate (L, DP, Y, S, &monthlyPtr, &status);
printf("Monthly payment <RM>: %f\n", monthly);
printf("Status: %s\n", &status);
return 0;
}
void loan_calculate (float L, float DP, int Y, float S, float *monthlyPtr, char *statusPtr, float I){
*monthlyPtr = ((L-DP) + ((L-DP) * (I/100) * Y)) / (12 * Y);
if (*monthlyPtr <= ((25/100)*S))
*statusPtr = "ELIGIBLE";
else
*statusPtr = "NOT ELIGIBLE";
return;
}
and.. this are the errors that occur..
Code:
a.c: In function `main':
a.c:26: error: `monthlyPtr' undeclared (first use in this function)
a.c:26: error: (Each undeclared identifier is reported only once
a.c:26: error: for each function it appears in.)
a.c:26: error: `status' undeclared (first use in this function)
a.c:26: error: too few arguments to function `loan_calculate'
a.c: In function `loan_calculate':
a.c:37: warning: assignment makes integer from pointer without a cast
a.c:40: warning: assignment makes integer from pointer without a cast