This code is supposed to convert a decimal to a 16-bit binary. Can you guys please help me understand lines 10-11 and 22-23, thanks
#include <stdio.h>
int main() {
// Declare variables
unsigned int decimal, binary = 0;
int i;
// Ask for user's input
printf("Enter non-negative decimal integer to convert: ");
if (scanf("%u", &decimal) != 1) {
printf("Error occured\n");
return 1; // Exit with an error code
}
// Check if the input number can be represented in 16 bits
if (decimal > 65535) {
printf("Error occured\n");
return 1; // Exit with an error code
}
// Convert decimal to binary
for (i = 15; i >= 0; i--) {
int bit = (decimal >> i) & 1;
printf("%d", bit);
}
printf("\n");
return 0; // Exit without an error code
}