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 →

String Parsing with strtok()

Posted on February 13, 2016 by dgookin
Reply

A handy tool for slicing up a string of text into chunks is the strtok() function. If you understand the strtok() function, it helps you better understand how more complex parsing functions work.
Continue reading →

Posted in Lesson | Leave a reply

Display Errors and errno Messages Automagically

Posted on February 6, 2016 by dgookin
Reply

Last week’s Lesson discussed the errno variable and how it can display more detailed error messages. I have two updates to that Lesson.
Continue reading →

Posted in Lesson | Leave a reply

The errno Variable

Posted on January 30, 2016 by dgookin
Reply

One of the C language’s universal variables is errno. It contains a code describing details about why a particular operation failed. You can use errno in your code to provide better, more informative error messages for your programs.
Continue reading →

Posted in Lesson | Leave a reply

Your Code Goes “Oops!”

Posted on January 23, 2016 by dgookin
Reply

Error messages have a notorious reputation in the computer kingdom. It’s well-deserved, but as a programmer you can better see how error messages evolved. Like documentation, i.e., the wretched manual (which is gone now), error messages are typically an afterthought in the software development cycle. It doesn’t have to be that way.
Continue reading →

Posted in Lesson | Leave a reply

Give Me a break

Posted on January 16, 2016 by dgookin
Reply

I received an email question recently about the power of the break keyword. The answer to the question is that you can only break out of the current loop or switch-case structure. Even in a nested loop, or a switch-case structure within a loop, break affects only the current element.
Continue reading →

Posted in Lesson | Leave a reply

The ungetc() Function

Posted on January 9, 2016 by dgookin
Reply

The standard C library contains a clutch of functions you use all the time, such as printf(), getchar(), malloc(), time(), rand(), and others. If you look in the library, you may discover some oddball functions that you’ve never used. One of those oddball functions might be ungetc().
Continue reading →

Posted in Lesson | Leave a reply

Your Own strdup() Function

Posted on January 2, 2016 by dgookin
Reply

In last week’s Lesson, I demonstrated the strdup() function. That function isn’t available in every C language library, but it’s easy to craft your own.
Continue reading →

Posted in Lesson | Leave a reply

To Copy or to Duplicate a String

Posted on December 26, 2015 by dgookin
Reply

The C library function to copy a string is strcpy(), which (I’m guessing) stands for string copy.
Continue reading →

Posted in Lesson | Leave a reply

99 Bottles of Beer

Posted on December 19, 2015 by dgookin
Reply

This month’s Exercise involves coding the lyrics for a cumulative song. Perhaps the most famous, and certainly the most obnoxious, cumulative song is the old warhorse, 99 Bottles of Beer.
Continue reading →

Posted in Lesson | Leave a reply

Check That Sum

Posted on December 12, 2015 by dgookin
Reply

The old computer processing adage is “garbage in, garbage out.” What it means is that unless your data is good, don’t expect to see good results. So what can be done to ensure that the data is good? A checksum, that’s what.
Continue reading →

Posted in Lesson | 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