[此贴子已经被作者于2017-12-13 09:11编辑过]
#include <stdio.h> void splitfloat(float x,int *intpart,float *fracpart) { *intpart=(int)x; *fracpart=(x-*intpart); } int main(void) { float a=3.14; int b=0; float c=0.0; splitfloat(a,&b,&c); printf("%d和%f\n",b,c); return 0; }