Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

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

Category Archives: Lesson

Post navigation

← Older posts
Newer posts →

Erasing Text for Stream Output

Posted on July 6, 2024 by dgookin
Reply

One of my first programming obsessions was online communications. I wrote several modem programs for the TRS-80 (in Z80 Assembly) and then moved to the IBM PC/MS-DOS where I coded communications programs in both Assembly and C. I learned a few things.
Continue reading →

Posted in Lesson | Leave a reply

A Grid of Random Stars, Part VII

Posted on June 29, 2024 by dgookin
Reply

The final (and merciful) update to my Grid of Random Stars program involves two major changes. First, because I call the update_grid() function only once, it can be incorporated into the main() function, no program. Second, I remove pointer notation.
Continue reading →

Posted in Lesson | Leave a reply

A Grid of Random Stars, Part VI

Posted on June 22, 2024 by dgookin
Reply

The program may output what I want, but the code isn’t done yet. Continuing from last week’s Lesson, I’d like the program to output a single grid showing a summary of all the rectangles found. This update requires more changes to the existing code.
Continue reading →

Posted in Lesson | Leave a reply

A Grid of Random Stars, Part V

Posted on June 15, 2024 by dgookin
Reply

The two problems I recognized in the code from last week’s Lesson were that scan_column() and find_right() don’t need to be separate functions. Also, the code fails to find all the rectangles in the grid, which is bad. Time to fix the code!
Continue reading →

Posted in Lesson | Leave a reply

A Grid of Random Stars, Part IV

Posted on June 8, 2024 by dgookin
Reply

I was so excited with last week’s code that I didn’t bother to confirm that it worked properly. No, I was eager to see graphic output of the found rectangles.
Continue reading →

Posted in Lesson | Leave a reply

A Grid of Random Stars, Part III

Posted on June 1, 2024 by dgookin
Reply

The next update to my pattern-finding program is to hunt down and find a clutch of asterisks in the grid that form a rectangle. Figure 1 illustrates what I’m after.
Continue reading →

Posted in Lesson | Leave a reply

A Grid of Random Stars, Part II

Posted on May 25, 2024 by dgookin
Reply

To count all possible rectangles in a random grid requires a lot of scanning. My first thought was that the process would involve recursion. I wasn’t 100 percent certain, but I wanted to prep the code for such a possibility.
Continue reading →

Posted in Lesson | Leave a reply

Analyzing a Grid of Random Stars

Posted on May 18, 2024 by dgookin
Reply

Ever since I was a little boy and coded my first nested loop, I’ve enjoyed messing with grids in C. I’ve done monthly calendars in grids, rotated grids, manipulated grids mathematically — all sorts of fun girddy stuff. But I’m not done yet.
Continue reading →

Posted in Lesson | Leave a reply

Messing with Array Subscripts

Posted on May 11, 2024 by dgookin
4

Array notation involves the array’s name followed by a set of square brackets. Within these brackets is a reference to the array element’s number. It’s important to remember that the first element is zero. But the subscript need not always be a constant integer.
Continue reading →

Posted in Lesson | 4 Replies

Tending Toward Obfuscation

Posted on May 4, 2024 by dgookin
Reply

I’m always mindful of the beginner when I write code for this blog. Even with my own code, I often go to pains to write things “the long way” just because I’m in the habit. Not every coder is so thoughtful. The reason is that C tends toward obfuscation. We must revel in this capability.
Continue reading →

Posted in Lesson | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

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

Recent Comments

  • dgookin on Is It a “Real” Triangle? – Solution
  • Chris Webb on Is It a “Real” Triangle? – Solution
  • dgookin on A Colorful Hexdump
  • Chris Webb on A Colorful Hexdump
  • dgookin on Code Page 437

Meta

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

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress