From 1d62eab5a7607042158bbd8fe07695d8c8fe8825 Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Thu, 4 Aug 2022 11:50:35 +1200 Subject: [PATCH] vault backup: 2022-08-04 11:50:35 --- content/notes/08-intro-to-c.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/content/notes/08-intro-to-c.md b/content/notes/08-intro-to-c.md index 2077f35b9..b1e39ab65 100644 --- a/content/notes/08-intro-to-c.md +++ b/content/notes/08-intro-to-c.md @@ -98,4 +98,30 @@ typedef struct - the scope of this routine is local to this file - this variable maintains its value between calls +``` +void keeper(void) { + static uint64_t times_called = 0; + times_called++; + printf("Count:%llu\n", times_called); +} +``` +## typecasting +like java +``` +uint64_t y = 1024; +unit32_t x = (unit32_t) y; +``` + +## Keywords to ignore +- auto + - all local variables are auto +- register + - deprecated + +## keywords to think about +- volatile + - do not optimize accesses to this variable + - might be changed by another thread or a harware event + - you're likely to see this in operating system souce code + - you're likely to see this in multithreaded programs