今天学习了指针的第3个作用
#include <stdio.h>
int getRemainder(int num1, int num2, int* res);
int main()
{
int a = 10;
int b = 3;
int res = 0;
int flag = getRemainder(a, b, &res);
if (flag == 0)
{
printf("余数为:%d", res);
}
return 0;
}
int getRemainder(int num1,int num2,int*res)
{
*res = num1 % num2;
if (num2 == 0)
{
return 1;
}
return 0;
}