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

Toot

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

Descendants

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

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

Written by Amber on 2025-01-08 at 23:25

@lcamtuf@infosec.exchange there is only one gif that can describe my reaction to this.

=> View attached media

=> More informations about this toot | More toots from puppygirlhornypost2@transfem.social

Written by Mondanzo on 2025-01-15 at 17:04

@puppygirlhornypost2 @lcamtuf wait, this is intended to be confusing and worrisome? I thought this was originally a genuine approach to C programming ​:sobbing:​

=> More informations about this toot | More toots from mondanzo@wolfdo.gg

Written by Drahflow on 2025-01-08 at 22:09

@lcamtuf The second example is clear enough. But the first, uh, gcc's hand-crafted parser clowns the standard committee yet again.

💯 for "using" the function and avoiding the warning.

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

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

This content has been proxied by September (ba2dc).