this is my latest code
#include <stdio.h>
void loan_calculate (float, float, int, float, float *, char* , float);
int main ()
{
float L, DP, S, I, monthly;
int Y;
char statusPtr;
printf("LOAN ADVISOR\n");
printf("Car purchase price/loan <RM>: ");
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>: ");
scanf("%f", &DP);
printf("Payment period <in year>: ");
scanf("%d", &Y);
printf("Monthly salary: ");
scanf("%f", &S);
loan_calculate(L, DP, Y, S, &monthly, statusPtr, I);
printf("Monthly payment <RM>:%.2f\n", monthly);
printf("Status: %s", statusPtr);
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)*(*monthlyPtr))){
statusPtr = 'E';
char *E = "ELIGIBLE";
}
else{
statusPtr = 'N';
char *N = "NOT ELIGIBLE";
}
return;
}
Error occur:
a.c: In function `main':
a.c:26: warning: passing arg 6 of `loan_calculate' makes pointer from integer without a cast
a.c: In function `loan_calculate':
a.c:37: warning: assignment makes pointer from integer without a cast
a.c:41: warning: assignment makes pointer from integer without a cast
ok.. i really apreciate u guys help..
its really help me to understand it step by step..
however..
for this code
printf("Status: %s", statusPtr);
and this one..
if (*monthlyPtr <= ((25/100)*(*monthlyPtr))){
statusPtr = 'E';
char *E = "ELIGIBLE";
}
else{
statusPtr = 'N';
char *N = "NOT ELIGIBLE";
i still can't figure out..
thanks veda87, kiddies and ZekeDragon for your help.. :thumbup:
but, i need to do the E=ELIGIBLE & N=NOT ELIGIBLE in function definition..
in main function, i just have to print it.. so it will give the output:
Status: ELIGIBLE or..
Status: Not Eligible
The problem is, i cant print it out.. :crying: