hey guys,
bizarre one this… can anyone tell me why my program is finishing on exit code -1:
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[])
{
double pi = 3.14;
double integerPart;
double fractionPart;
//pass the address of integerPart as an argument
fractionPart = modf(pi, &integerPart);
//Find the value stored in integerPart
printf("integerPart = %.0f, fractionPart = %.2f\n", integerPart, fractionPart);
double trouble = 8.43827;
double firstNumber;
double afterDecimal;
//pass address of the decimal as an argument
afterDecimal = modf(trouble, &firstNumber);
printf("firstNumber = %.0f, afterDecimal = %.5f\n", firstNumber, afterDecimal);
return 0;
}
result: integerPart = 3, fractionPart = 0.14
firstNumber = 8, afterDecimal = 0.43827
Program ended with exit code: -1