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 →

Forking the Grandchildren

Posted on May 21, 2022 by dgookin
Reply

I wrote about forking a while back, in June 2015. The fork splits a program into two processes, each capable of handling different tasks simultaneously. The power behind this trick is the fork() function.
Continue reading →

Posted in Lesson | Leave a reply

From Decimal Value to a String

Posted on May 14, 2022 by dgookin
3

The challenge for this month’s Exercise is to split a decimal value into its integer and fractional portions. But what if you need the fractional portion as a string?
Continue reading →

Posted in Lesson | 3 Replies

Splitting a Decimal Value – Solution

Posted on May 8, 2022 by dgookin
2

Cleaving a decimal value into its integer and fractional portions is a neat trick, one that relies upon C natural capability to thwack off the decimal portion of a float when it’s recast as an integer. Knowing about this conversion makes solving this month’s Exercise a whole lot easier.
Continue reading →

Posted in Solution | 2 Replies

Conditional Expressions Used as Values

Posted on May 7, 2022 by dgookin
Reply

It was weird when I first saw it: A conditional expression used to determine a value. It sounds odd, but it works.
Continue reading →

Posted in Lesson | Leave a reply

Splitting a Decimal Value

Posted on May 1, 2022 by dgookin
4

Difficulty: ★ ★ ☆ ☆

A floating point, or real number, has two parts: Before the decimal comes the integer part. After the decimal is the fractional part. Sometimes it’s necessary to split such a value, so that your code can deal separately with the integer and fractional parts.
Continue reading →

Posted in Exercise | 4 Replies

Outputting an Unterminated Buffer

Posted on April 30, 2022 by dgookin
Reply

Properly formed strings in C are terminated with the null character, \0. Accept it or die!

However . . .
Continue reading →

Posted in Lesson | Leave a reply

Desperately Freeing Allocated Memory

Posted on April 23, 2022 by dgookin
1

The critical issue about allocating and then freeing memory is to avoid a memory leak. This condition happens when a memory chunk gets lost, leaving the it lingering in RAM not doing anyone any good. Most often a memory leak occurs in a function.
Continue reading →

Posted in Lesson | 1 Reply

Freeing Allocated Memory

Posted on April 16, 2022 by dgookin
2

One criticism I receive is that my code examples, from both my online training material as well as in my C programming books, fail to free any allocated memory before the program quits. This assertion is correct, and I have a darn good reason why!
Continue reading →

Posted in Lesson | 2 Replies

C Blog 9th Anniversary

Posted on April 13, 2022 by dgookin
Reply

The first post on this blog was made on April 13, 2013.

Posted in Uncategorized | Leave a reply

Color Text, Part II

Posted on April 9, 2022 by dgookin
Reply

From last week’s Lesson, I showed how ANSI codes are used to set color text in terminal output. It’s time to go nuts showing the possibilities.
Continue reading →

Posted in Lesson | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Colorful Data Chunks
  • A Little Bit Off the Sides – Solution
  • Working with Data Chunks
  • A Little Bit Off the Sides
  • From Decimal to Fraction

Recent Comments

  • dgookin on A Little Bit Off the Sides – Solution
  • Jack Bolt on A Little Bit Off the Sides – Solution
  • dgookin on Working with Data Chunks
  • Chris Webb on Working with Data Chunks
  • M.Stumpfl on From Decimal to Fraction

Meta

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

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress