Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

  • C For Dummies (home)
  • History
  • Series
  • Supplemental
  • Blog Miscellany

Post navigation

← Older posts
Newer posts →

Wide Characters and Unicode, Part I

Posted on June 24, 2017 by dgookin
Reply

At the dawn of the microcomputer era, lowercase text was considered a big deal. That’s because many home computers at the time displayed only uppercase letters. Memory was tight. Full-ASCII character generators added to the system’s cost. Yes, a microcomputer that displayed lowercase text was a big deal.
Continue reading →

Posted in Lesson | Leave a reply

The “Gazinta” Function

Posted on June 17, 2017 by dgookin
2

Division is the last of the four basic arithmetic operations taught. Addition is easiest, followed by subtraction. Multiplication is merely aggressive addition. Division is a weird un-multiplication combined with subtraction thing, which is probably why educators save the concept for last.
Continue reading →

Posted in Lesson | 2 Replies

The Elvis Operator

Posted on June 10, 2017 by dgookin
Reply

A new operator was added to the C language in the last revision, one that I don’t cover in my books. (I’m not sure how that happened.) Anyway, it’s the Elvis operator. Unless you’re a fan of the ternary operator, you’ll probably never use it.
Continue reading →

Posted in Lesson | Leave a reply

The Perfect Shuffle – Solution

Posted on June 8, 2017 by dgookin
Reply

A perfect shuffle splits a deck of cards in two. The second half is folded evenly into the first half, so that every other card comes from the first and last half of the deck, respectively. This type of shuffle is practically impossible in real life, but for a computer simulation it’s not that difficult.
Continue reading →

Posted in Solution | Leave a reply

Shift and Verify a Magic Square

Posted on June 3, 2017 by dgookin
Reply

Last week’s Lesson showed how to shift a column of numbers in an array grid. The array just happens to be a magic square. So the puzzle is to run the array through the confirm_magic() function, which was presented in a previous week’s Lesson. Seems easy.
Continue reading →

Posted in Lesson | Leave a reply

The Perfect Shuffle

Posted on June 1, 2017 by dgookin
Reply

A perfect shuffle occurs when you shuffle a deck of cards so that all the cards from the second half of the deck are perfectly interspliced between the cards in the first half of a deck. Such a shuffle is illustrated in Figure 1.
Continue reading →

Posted in Exercise | Leave a reply

The Square is Really Magic

Posted on May 27, 2017 by dgookin
Reply

Before moving off the topic of arrays and their bogus dimensions, I want to play further with a magic square. Specifically, it intrigues me that you can shift rows or columns within the square and it doesn’t affect the magical properties.
Continue reading →

Posted in Lesson | Leave a reply

Pass a 2D Array to a Function (No Pointers!)

Posted on May 20, 2017 by dgookin
Reply

Suppose you have an array of integers which represents a magic square: All the rows and columns — even the two diagonals — add to the same total. To prove it, you create a function, confirm_magic() that processes the array and validates the math. You have just one problem . . .
Continue reading →

Posted in Lesson | Leave a reply

A Single-Dimension Array Pretends to be Two-Dimensions

Posted on May 13, 2017 by dgookin
Reply

Multi-dimension array notation is just a handy shortcut for you, the human programmer. Internally, an array is a single-file line of values, one marching after another. The dimensional aspect helps humans organize the array’s data, but all that organization is superficial.
Continue reading →

Posted in Lesson | Leave a reply

Day-of-the-Year Calculation – Solution

Posted on May 8, 2017 by dgookin
Reply

The solution for this month’s Exercise involves two steps. The first is to generate a random value from 1 to 365 (inclusive) as a day-of-the-year value. The second is to determine upon which month and day that value falls. That part may offer more difficulty than you anticipate.
Continue reading →

Posted in Solution | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Reading Raw Input
  • Cooked or Raw?
  • Is It a “Real” Triangle? – Solution
  • Getting and Setting the File Position Indicator
  • Is It a “Real” Triangle?

Recent Comments

  • dgookin on Reading Raw Input
  • Chris Webb on Reading Raw Input
  • dgookin on Is It a “Real” Triangle? – Solution
  • Chris Webb on Is It a “Real” Triangle? – Solution
  • dgookin on A Colorful Hexdump

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress