Basic types

Type initialization

//const + type name for constants
//type name or auto (type from the value) for variables

//Int
int number = 42, otherNumber = 37;
const unsigned long long maxUInt64 = ULLONG_MAX;
constexpr int Mb = 1048576;

//Exact width integers (stdint.h)
uint8_t byte = 255;
int32_t million = 1'000'000;

//Double
const double e = 2.71828;
double billion = 1E+9;

//Float
const float pi = 3.14f;

//String: an array of char with a zero character at the end
const char *greeting = "Hello";

//Multiline string: the compiler glues adjacent literals together
const char *text = "this is some\n"
                   "multiline text";
//text is "this is some\nmultiline text"

//Bool (keywords since C23)
const bool sunIsStar = true;
auto needBackUp = false;

//Character "A"
char charA = 'A'; //65, 0x41, '\x41'

printf("number is %d\n", number);
printf("otherNumber is %d\n", otherNumber);
printf("maxUInt64 is %llu\n", maxUInt64);
printf("Mb is %d\n", Mb);
printf("byte is %d\n", byte);
printf("million is %d\n", million);
printf("e is %g\n", e);
printf("billion is %g\n", billion);
printf("pi is %g\n", pi);
printf("greeting is %s\n", greeting);
printf("text is %s\n", text);
printf("sunIsStar is %s\n", sunIsStar ? "true" : "false");
printf("needBackUp is %s\n", needBackUp ? "true" : "false");
printf("charA is %c\n", charA);