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 →

Fully Abusing the scanf() Function

Posted on September 5, 2020 by dgookin
Reply

It’s sad but understandable that most C programmers use the scanf() function in a limited capacity. True, the function is dorky, so I accept any aversion to its use. It can also be abused to pose a security risk. Still, for “research purposes,” it’s entertaining to see how much the function can be twisted and torqued.
Continue reading →

Posted in Lesson | Leave a reply

Unraveling the scanf() Function

Posted on August 29, 2020 by dgookin
Reply

One of the things I dread in my books, is foisting the scanf() function upon a beginner. I have no way around this frustration.
Continue reading →

Posted in Lesson | Leave a reply

Initializing an Array

Posted on August 22, 2020 by dgookin
2

graphic
Like all variables in C, arrays are declared uninitialized. They contain whatever junk already exists in memory. Initializing an array is therefore important. It can be done in one of three ways: as it’s declared, in a loop, or as it’s used in the code.
Continue reading →

Posted in Lesson | 2 Replies

The 21 Number Game

Posted on August 15, 2020 by dgookin
Reply

illustration
I occasionally visit Rosetta Code to look for C language inspiration. The site offers a programming puzzle, then presents solutions in various languages. A recent challenge involved the 21 number game — but the C language had no solution!
Continue reading →

Posted in Lesson | Leave a reply

The switch Condition

Posted on August 8, 2020 by dgookin
Reply

switch case
A switch-case structure performs a complex decision in your code, similar to a cascade of if else-if else statements. The structure works like a comparison as a whole, acting upon single values or variables. But its construction need not lack expressions.
Continue reading →

Posted in Lesson | Leave a reply

Digits of Significance

Posted on August 1, 2020 by dgookin
2

In last week’s Lesson, I lamented that C lacks a function to compare two floating point values based on a significant number of digits. Being a C programmer, I resolved this issue by writing a function that accomplishes this suddenly necessary task.
Continue reading →

Posted in Lesson | 2 Replies

My Own Square Root Funtion

Posted on July 25, 2020 by dgookin
Reply

From last week’s Lesson, I plowed into a BASIC programming book I worked on 35 years ago. (Yes, I’m old.) In it, substitute code was offered for commands not available in every version of BASIC. To appreciate this necessity, understand that back in those days computers weren’t file-to-file compatible, so translating programming language dialects was part of the job.
Continue reading →

Posted in Lesson | Leave a reply

Getting to the Square Root of the Problem

Posted on July 18, 2020 by dgookin
1

The first part of my writing career began by updating a computer book bestseller, The BASIC Handbook. This tome served as a lexicon for the various BASIC programming language dialects, allowing users from one version of BASIC to translate and use code from another version.
Continue reading →

Posted in Lesson | 1 Reply

The gettimeofday() Function

Posted on July 11, 2020 by dgookin
2

Every so often I scour C library references, looking for fun or unusual functions. When I find one I’m unfamiliar with or something I’ve seldom used, I write about. After all, the functions do practical things that might be worthy of exploration. A recent example is gettimeofday().
Continue reading →

Posted in Lesson | 2 Replies

What Size Integer?

Posted on July 4, 2020 by dgookin
Reply

Things were stable back in the old days. When I first coded C, a char was 8-bits (a byte), and an int was 16-bits. The short was also 16-bits and the long, it was truly long at 32-bits. Today, things aren’t as consistent.
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