我不明白为什么答案是5,我会写下面的程序

Pra*_*bha 1 c

#include<stdio.h>
void main()
{
 int cats,dogs,others,total_pets;
 cats=10;
 dogs=43;
 others=36;
 total_pets=cats+dogs;
 printf("there are %c  total pets are",total_pets);
}
Run Code Online (Sandbox Code Playgroud)

cod*_*ict 10

使用%d代替%cprintf.

价值total_pet53.当您使用时%c,printf您正在尝试打印其ASCII值(如果53恰好是)的字符5.