The rand() function returns a pseudo-random number as a long int value. That value helps your code generate random numbers in the long int range. It can also be manipulated to yield random real number values, but that process involves . . . math.
Continue reading
Author Archives: dgookin
To Form a More Perfect union
Next to enum, one of the more curious C language keywords is union. It’s tremendously unpopular. I would offer that it’s also not needed, but no one is talking about deprecating it.
Continue reading
The Mysterious enum Keyword
They’re the orphan keywords, urchins, unwanted, unused, unloved. Of the 32 C language keywords, a handful are seldom used. These include: auto, enum, register, union, and volatile.
Continue reading
Spelling Alphabet – Solution
This month’s task was to create code that translates spelling from a single word into the corresponding NATO phonetic alphabet words. For input such as hello the output would be something like:
Hotel Echo Lima Lima Oscar
Continue reading
A Fork in Your Code
All of the code I’ve written in my books as well as demonstrated on this blog has been single-tasking: The program runs as one process, does one thing, in order, and then terminates. With this Lesson, that streak ends.
Continue reading
Spelling Alphabet
The spelling alphabet is a tool used by the military, police, and other professionals. It helps them to sound cool when they spell names. You’ve probably attempted to spell that way yourself, even if you didn’t know any official spelling alphabet. Lots of people say, “N as in Nancy.” That’s how the spelling alphabet works.
Continue reading
Know Your Process
Program. Software. Application. Process. These are all terms that describe different aspects of a similar thing.
Continue reading
The Marvelous popen() Function
To launch and run another program from within your code, use the system() function. When your code must examine or save that program’s output, use the popen() function.
Continue reading
Execute and Leave
The system() function allows you to run one program from within another. If it’s your desire to launch another program and have your program quit, you can immediately follow system() with an exit() function. Or you can go out of your way and use the oddball execl() function.
Continue reading
Let’s Go Bowling – An Entire Game – Solution
To make the conversion between simulating a single frame of bowling and an entire game isn’t that simple, which is mostly due to calculating the dreaded 10th Frame.
Continue reading