void getFormattedTime(int inputSeconds, int* totalHours, int* totalMinutes, int* totalSeconds) {
totalHours = (inputSeconds / 3600);
totalMinutes = (inputSeconds - (3600 * *totalHours)) / 60;
totalSeconds = (inputSeconds - (*totalHours * 3600) - (*totalMinutes*60));
printf("Formatted Total Time: %d:%d:%d", *totalHours,
*totalMinutes, *totalSeconds);
}
我不断得到一个赋值,使指针从整数开始而没有强制转换错误,而且我真的不知道如何解决它。请帮忙!
答案 0 :(得分:0)
您确实是在将整数辅助到指针。试试这个:
*totalHours = (inputSeconds / 3600);
*totalMinutes = (inputSeconds - (3600 * *totalHours)) / 60;
*totalSeconds = (inputSeconds - (*totalHours * 3600) - (*totalMinutes*60));