NOOB Question?

Edit: added symbol... "?" // Sorry about that. Doc
How/why/what is this symbol an C, C++

Doc

?

I see no symbol.

I see no ships either.

Awol, Yes... "?"

Doc

What are you talking about?

It's used in a kind of "if" statement:

x = a>b ? 3 : 9;

Which means: If A is greater than B then set X to 3, else set X to 9.

It's the same as writing:

if(a>b)
{
  x = 3;
} else {
  x = 9;
}

You can use pretty much any comparison operator, and you can assign any variable type that is assignable (basically anything other than arrays).

Oh,Thank you. I have been unable to find time to get much beyond chapter 3 C C++ Primer 4Th ed
So my questions about C might well be rather infantile...

Doc

That's ok.

I have been programming for 30-odd years, and much of it in C.

I still have to regularly refer to my "bible":

All 1250 pages of it :wink:

Or use the somewhat shorter K&R

Is the Primer a good book to learn from and If 'not or not the best' then which is?

Doc

Second edition Kernighan and Ritchie

No book is "the best", and no book is perfect.

The best book for you to learn C from is the book which you understand the best. If you get on well with the primer, then the primer is good for you.

Thank you both my question was more about the merits... I understand about 'get along' as easier to comprehend
Hardware is EASY, but I learned to code in PDS 7.1 which was the origin of Visual Basic... before the Visual part was added
and this is a much different world.

Doc

Do yourself a favour and get a copy of K&R anyway. It's very well written and, as AWOL mentioned, mercifully brief. I've found that when learning this kind of stuff, it helps to have several books on the same topic. For C++ I like O'Reilly's "C++ The Core Language" - it was the fourth book I read on C++ and the one that finally got it to take,

Kelley and Pohl's book is also very good, but not of immediate relevance to microcontrollers

Thank you one and all I have a good beginning now and from a friend a couple of Gig's of computer books
So I think I have them all.

Doc