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 →

Parsing Integer Values Into a time_t Value

Posted on February 13, 2021 by dgookin
2

Pulling a date from a string involves slicing the string into substrings, which are then converted into values for year, month, and day. Last week’s Lesson demonstrated such code. This week, the final step is accomplished, converting year, month, and day integers into a time_t value.
Continue reading →

Posted in Lesson | 2 Replies

A Pair of Arrays – Solution

Posted on February 8, 2021 by dgookin
2

The challenge for this month’s Exercise is to initialize two different arrays to two sets of values. You should try to use only one loop and try to use a single statement to make the element assignments.
Continue reading →

Posted in Solution | 2 Replies

Parsing and Converting

Posted on February 6, 2021 by dgookin
2

The goal stated in last week’s Lesson is to convert a date formatted in a filename string into a time_t value. The filename string must be scanned for expected year, month, and date values. This process involves a custom function, convert(), as well as the strtol() function to translate strings of digits into long int values.
Continue reading →

Posted in Lesson | 2 Replies

A Pair of Arrays

Posted on February 1, 2021 by dgookin
Reply

Removing redundancies from your C code may not be your first goal, but it’s something you can definitely find later. One example is when you must initialize a pair of arrays. Why use two loops when one will do?
Continue reading →

Posted in Exercise | Leave a reply

It’s Parsing Time

Posted on January 30, 2021 by dgookin
Reply

A recent puzzle presented itself, one where I must extract a date based on a file’s name. The date is part of the name, but my code required I translate the date into a time_t value. It’s an awesome programming puzzle that involves many different tricks.
Continue reading →

Posted in Lesson | Leave a reply

The 27th International Obfuscated C Code Contest

Posted on January 23, 2021 by dgookin
Reply

The results of the 27th International Obfuscated C Code Contest were announced earlier this month. The code is amazing. It runs. It’s horrifyingly cryptic.
Continue reading →

Posted in Lesson | Leave a reply

Compiler Options in Code::Blocks

Posted on January 16, 2021 by dgookin
Reply

Like all IDEs, Code::Blocks is effectively a front for the clang, minGW, or gcc compiler lurking somewhere under its skin. While you don’t use these command line tools directly, you can control their options and settings from within the IDE.
Continue reading →

Posted in Lesson | Leave a reply

Compiler Options at the Command Prompt

Posted on January 9, 2021 by dgookin
3

The traditional C compiler is cc. Its GNU replacement in the Linux world is gcc. A better option is the LLVM clang compiler. As commands typed at a prompt, you control these compilers by setting command line options or switches.
Continue reading →

Posted in Lesson | 3 Replies

Find the Most Factors – Solution

Posted on January 8, 2021 by dgookin
Reply

The challenge for this month’s Exercise is to discover those values in the range 1 to 999 that have the highest number of factors. Never mind the math! Let C and the computer do the work for you.
Continue reading →

Posted in Solution | Leave a reply

Emulating the foreach Keyword

Posted on January 2, 2021 by dgookin
Reply

In last week’s Lesson, I covered how to obtain the number of elements in an array. This process is the first step to emulating the foreach keyword in the C language.
Continue reading →

Posted in Lesson | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • The Ever-Expanding Pointer Array
  • Heron’s Formula – Solution
  • Coding a Better stringcopy() Function
  • Heron’s Formula
  • Copying Strings

Recent Comments

  • dgookin on Heron’s Formula
  • Chris Webb on Heron’s Formula
  • dgookin on Heron’s Formula
  • Chris Webb on Heron’s Formula
  • dgookin on Finding Those Pesky Null Characters!

Meta

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

Copyright © 1997-2025 by QPBC.
All rights reserved

Proudly powered by WordPress