Ancestors

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:58

My new C programming book is slowly taking shape. If you want to learn along, let's start with the basics of control flow:

http://godbolt.org/z/3GerY3zEc

1/5

=> View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:58

From there, we can progress to function definitions and lexical scopes:

https://godbolt.org/z/GevPGhnYc

2/5

=> View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:59

Of course, no C tutorial is complete without an explanation of basic loops:

  1. https://godbolt.org/z/oshh599M1

  1. https://godbolt.org/z/ff4a9coPY

3/5

=> View attached media | View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:59

It is also important to understand switch() statements:

https://godbolt.org/z/MqGb63x69

4/5

=> View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:59

But the most convenient feature of C is line numbering:

https://godbolt.org/z/dfsKGqYGz

5/5

=> View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Toot

Written by tekhedd on 2025-01-08 at 20:54

@lcamtuf The more I stare at this code, the more I think I actually hate you. I mean, in a good way, but still. 😉

=> More informations about this toot | More toots from tekhedd@byteheaven.net

Descendants

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113794721933740054
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
278.966478 milliseconds
Gemini-to-HTML Time
2.383684 milliseconds

This content has been proxied by September (ba2dc).