boolean datatype in c

i have gone through some search results and found that we can implement it through enum, but why this program giving output as 4,4

#include <stdio.h>
typedef enum bolean {no,yes} billion;
int main(int argc, char const *argv[])
{
	int testc;
	billion bot;
	printf("%lu, %lu\n", sizeof(testc), sizeof(bot));
	return 0;
}

In C, any integral type shorter than int, is promoted to int when passed to printf(). Hence, we get 4, 4 as the output here.

Quoting from the text K&R,

A.6.1 Integral Promotion

“A character, a short integer, or an integer bit-field, all either signed or not, or an object of enumeration type, may be used in an expression wherever an integer may be used. If an int can represent all the values of the original type, then the value is converted to int; otherwise the value is converted to unsigned int. This process is called integral promotion.”

1 Like

so, if i write a program with this method, i won’t end up in using more memory?
right?

//