Why Nostr? What is Njump?
2023-08-23 23:32:03
in reply to

ICScaryThings on Nostr: old school kirby ​ The statement is more confusing when you are new to C because ...

The statement is more confusing when you are new to C because other languages (e.g. python, etc.) don't often allow assignment inside a nested expression and even if they do they usually don't return a value. In C when I do e.g. (x = 5) + 1, it assigns to variable x first then returns the same value assigned. Thus "(x = 5)" reduces to 5 and then is added to 1.

The thing I wrote above assigns the pointer address in the nested expression and then dereferences the returned pointer to set the terminating null (0 == '\0' in C so you can set that either way). These sorts of tricks are used a lot in the actual K&R book e.g. while ( (c = fgetc(f)) != EOF ) to loop over input one character at a time until the end of file.
Author Public Key
npub1v96a5ce23jgc0fpk3uxg44nm3fhgsnck63tf2ja98vwkq6tvgpus2v8jt9