Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

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

Author Archives: dgookin

Post navigation

← Older posts
Newer posts →

How Big is That File? – Solution

Posted on January 8, 2023 by dgookin
6

The challenge for this month’s Exercise is to return a file’s size without using the stat() function. My goal is to get you to think about various file tools and how they can be useful beyond their intended purpose.
Continue reading →

Posted in Solution | 6 Replies

Type Qualifiers: const and restrict

Posted on January 7, 2023 by dgookin
3

When describing data, the C language offers data types and data qualifiers. The data type is well known to any C programmer, defining the kind of data stored: char, int, float, and so on. The qualifier describes additional aspects of the data, such as how it’s used or whether the compiler should optimize the data’s storage.
Continue reading →

Posted in Lesson | 3 Replies

How Big is That File?

Posted on January 1, 2023 by dgookin
Reply

Difficulty: ★ ★ ☆ ☆

The stat() function returns various tidbits about a file, including its timestamp, permissions, file type, and the file’s size in bytes. This value can also be obtained without without using the stat() function, which is this month’s Exercise.
Continue reading →

Posted in Exercise | Leave a reply

A Character-to-String Function

Posted on December 31, 2022 by dgookin
Reply

Modern programming languages have libraries rich with routines, functions, and methods — plenty to pull together and craft the code you want without getting into the nitty-gritties or reinventing the wheel. As a mid-level language, C often requires that you craft your own functions, a task I undertake with eager glee.
Continue reading →

Posted in Lesson | Leave a reply

O Christmas Tree

Posted on December 24, 2022 by dgookin
Reply


It’s Christmas time, nerds rejoice! Welcome this festive season with a bit of programming acumen to festoon your old CRT monitor with some yuletide cheer.
Continue reading →

Posted in Lesson | Leave a reply

Tick Separators

Posted on December 17, 2022 by dgookin
Reply

No, a tick separator isn’t something you use on your dog during the summer. Instead, you find it in the upcoming C23 standard. A tick separator helps visually split up a long number, making it easier to read your code.
Continue reading →

Posted in Lesson | Leave a reply

Which C Version?

Posted on December 10, 2022 by dgookin
4

One thing I take for granted is which C standard I’m using. The differences between the versions are subtle, and the compiler chooses its standard by default. But this choice can be altered for compatibility or historical reasons.
Continue reading →

Posted in Lesson | 4 Replies

Quick Sorting Structures – Solution

Posted on December 8, 2022 by dgookin
Reply

The task for this month’s Exercise is to extract a structure member from a void pointer for use in the quick-sort compare() function. This isn’t a solution you can readily find on the Interwebs.
Continue reading →

Posted in Solution | Leave a reply

The Knight’s Tour

Posted on December 3, 2022 by dgookin
Reply

The task is truly complex: Navigating a knight around a chessboard, visiting each square but never the same square twice. It took me a while to code, and I don’t think my solution is particularly elegant, but it works.
Continue reading →

Posted in Lesson | Leave a reply

Quick Sorting Structures

Posted on December 1, 2022 by dgookin
4

Difficulty: ★ ★ ★ ★

I’ve covered the miraculous qsort() function elsewhere in this blog. It’s nifty, allowing you to sort all kinds of data with your only job being to code a compare() function. Most coders these days just copy-paste this function and call it good. But for sorting an array of structures, more brain muscle is required.
Continue reading →

Posted in Exercise | 4 Replies

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Storing and Interpreting Mouse Input
  • Where is the Mouse?
  • Pulling Numbers from a String – Solution
  • What is the Mouse Doing?
  • Pulling Numbers from a String

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