Simple C Language Program
Evaluate the number of 1 in binary code
# Include <stdio. h> # include <stdlib. h> int count_one_bit (unsigned int num) {int count = 0; while (num) {if (num % 2 = 1) count ++; num = num/2 ;} return count;} int main () {int ret = count_one_bit (255); printf ("% d \ n", ret); system ("pause ");}
This program is actually very simple in the C language, but I still feel that I have some details not very clear when I discuss it with my classmates, which means that my C language basics are still not solid. Therefore, I feel that if I want to learn a language well, I must lay a good foundation. I don't care how much I learned, but I must digest the learned knowledge. You need to do more to find out the problems and learn more. This is my first blog. In fact, these words are more for myself. Only when I do it can I be qualified to say it to others. Encourage everyone and cheer up.