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 →

Find the Vowel

Posted on April 20, 2019 by dgookin
Reply

I admit that sometimes I need to see someone else’s code before a formerly obscure function becomes useful to me. A case in point is the strchr() function, which I rarely use.
Continue reading →

Posted in Lesson | Leave a reply

Macros Galore!

Posted on April 13, 2019 by dgookin
Reply

In last week’s Lesson, I demonstrated how macros can save time, effectively replacing one-line functions in your code. One place I’ve used macros in my own code is when performing binary math operations.
Continue reading →

Posted in Lesson | Leave a reply

Macros or Functions

Posted on April 6, 2019 by dgookin
Reply

In C, a macro is a preprocessor directive that creates a shortcut, often a one-line expression to be inserted elsewhere in the code. Macros can make code more readable, but they can have a negative effect when implemented in a clumsy manner.
Continue reading →

Posted in Lesson | Leave a reply

Locale Settings Dear to You

Posted on March 30, 2019 by dgookin
Reply

The setlocale() function, mentioned in last week’s Lesson, both returns the current locale string and sets a new locale. It’s not necessary to call this function to gather locale details already known to your computer. To pluck out this detail, use the localeconv() function.
Continue reading →

Posted in Lesson | Leave a reply

Don’t be a Stranger to the Locale

Posted on March 23, 2019 by dgookin
Reply

A major hurdle in computer science was getting disparate computers to speak with each other. Not verbally, of course, but by exchanging files in compatible file formats. After this task was ironed out, professionals in white lab coats realized the next step was massaging program output to match the user’s language and other local preferences.
Continue reading →

Posted in Lesson | Leave a reply

Fetching the Search Path

Posted on March 16, 2019 by dgookin
2

The search path is a list of directories in which the operating system scans for programs. Its purpose is to allow quick access to common programs and system utilities without the necessity of typing a full pathname or changing to the right directory to start an application.
Continue reading →

Posted in Lesson | 2 Replies

Building a Format String

Posted on March 9, 2019 by dgookin
Reply

In the printf() function, the first argument is a format string. It can contain the various percent placeholders to represent values expressed in the remaining arguments. But can one of those arguments also contain placeholders?
Continue reading →

Posted in Lesson | Leave a reply

A Curious Thing About Array Notation

Posted on March 2, 2019 by dgookin
5

It’s nuts. All through your C training when you learned about arrays, you were taught the format: array[x] where array is the name of the array and x is the element number. But this expression can also be written as x[array].

Mind. Blown.
Continue reading →

Posted in Lesson | 5 Replies

Exit Status Defined Constants

Posted on February 23, 2019 by dgookin
Reply

The tradition for successfully exiting a command line program is to use return 0; or, as I write it, return(0);. Zero is the OK value, meaning a program exited cleanly. Other values returned represent specific conditions, not necessarily errors, but information that can be communicated to the operating system or some other program.
Continue reading →

Posted in Lesson | Leave a reply

The Element Doesn’t Exist

Posted on February 16, 2019 by dgookin
Reply

As a mid-level language, C has just as many positives as negatives with regards to accessing memory. One of the biggest negatives is C’s unflinching capability to access data that doesn’t exist.
Continue reading →

Posted in Lesson | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • What is the Largest Value?
  • Accessing the Mouse in a Terminal Window
  • Storing and Interpreting Mouse Input
  • Where is the Mouse?
  • Pulling Numbers from a String – Solution

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