指派运算符(强制类型转换)

强制类型转换

-#include<stdio.h>
int main(void)
{
int mice;
mice=(int)1.6+(int)1.7;
printf("Mice=%d\n",mice);

return 0;

}

带参数函数

-#include<stdio.h>
void pound(int n)
{
while(n-->0)
printf("#");
printf("\n");
}
int main(void)
{
int times=5;
char ch='!';
float f=6.0;

pound(times);
pound(ch);//函数参数char类型自动转化Int类型
pound((int)f);

}

posted @ 2021-03-18 09:34  菲阳公社  阅读(94)  评论(0)    收藏  举报