Re: [PIC] Learning C

Spehro Pefhany <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.pic
Message-ID <[email protected]>
At 03:56 AM 2024-11-14, you wrote:
>Ans 404 to you :-)
>
>Onew of the problems I have with trying to understand code examples in C is
>that so many of them are incomprehensibly dense.
>What would be five or six lines in Pascal or Basic is a single line in C.
>I appreciate that that is down to the programmer not the language but it is
>off putting
>i have to remind my self of the old adage:  You can write Pascal in any
>language

I do like the ternary operator '?' in C (and in some other languages)
which reduces several lines to one and is still very readable, maybe more
so.

variable = condition ? value_if_true : value_if_false

instead of

if (a > b) {
     result = x;
}
else {
     result = y;
}


just write

result = a > b ? x : y;

Best regards, Spehro Pefhany
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.