杨__羊羊
您可以使用(取决于平台的)内联汇编,例如,对于x86 :(也适用于负数)#include <stdio.h>int main() { int dividend = -42, divisor = 5, quotient, remainder; __asm__ ( "cdq; idivl %%ebx;" : "=a" (quotient), "=d" (remainder) : "a" (dividend), "b" (divisor) : ); printf("%i / %i = %i, remainder: %i\n", dividend, divisor, quotient, remainder); return 0;}