Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

  • C For Dummies (home)
  • History
  • Series
  • Supplemental
  • Blog Miscellany

Post navigation

← Older posts
Newer posts →

The camelCase to snake_case Conversion with Proper Memory Allocation

Posted on August 19, 2023 by dgookin
2

With all the storage available in a modern computer, it’s easy — and often perfectly okay — to be overly generous when allocating memory. Still, the old coder in me has a lingering desire to save every byte possible. So when it comes to crafting a solution for this month’s Exercise, my desire is to be byte stingy.
Continue reading →

Posted in Lesson | 2 Replies

A Better camelCase to snake_case Conversion

Posted on August 12, 2023 by dgookin
Reply

My solution for this month’s Exercise took some terrible assumptions. First, that the strings are merely output and not stored. Second, that the strings are perfectly formed camelCase and snake_case. In this Lesson, I address the first concern.
Continue reading →

Posted in Lesson | Leave a reply

From camelCase to snake_case – Solution

Posted on August 8, 2023 by dgookin
2

The challenge for this month’s Exercise is to convert a name from camelCase to snake_case and vice-versa. As usual, several approaches provide a possible solution. The directions were to output the results and not store them, so my solution is rather simple.
Continue reading →

Posted in Solution | 2 Replies

Using scanf() to Build a String – Part V

Posted on August 5, 2023 by dgookin
Reply

In my code update for last week’s Lesson, I used return statements to send strings back to the main() function. This technique works — only once, even though the strings are declared static in the token() function.
Continue reading →

Posted in Lesson | Leave a reply

From camelCase to snake_case

Posted on August 1, 2023 by dgookin
4

Difficulty: ★ ★ ☆ ☆

The Great Coding Wars host many battles. For example, VIM versus Emacs (add in Nano for extra military action). Also the fight between spaces and tabs for indenting. Add to these conflicts a minor skirmish: whether to use camelCase or snake_case naming conventions.
Continue reading →

Posted in Exercise | 4 Replies

Using scanf() to Build a String – Part IV

Posted on July 29, 2023 by dgookin
Reply

I refer to the process of converting special characters into strings as tokenizing. The token is a character or string — a code. This code is translated into something else, which allows the program to deal with complex items in a simple manner.
Continue reading →

Posted in Lesson | Leave a reply

Using scanf() to Build a String – Part III

Posted on July 22, 2023 by dgookin
Reply

Unless the code must run endlessly, such as a program that operates a gas pump, an endless loop isn’t something you want. From last week’s Lesson, I crafted an endless loop to accept single-word input from the scanf() function to build a string. But no string is output because the loop never ends! It’s time to address this situation.
Continue reading →

Posted in Lesson | Leave a reply

Using scanf() to Build a String – Part II

Posted on July 15, 2023 by dgookin
Reply

Trying to salve my frustration with the scanf() function, I decided in last week’s Lesson to try to use scanf() to build a string. Because the function terminates standard input at the first whitespace character (space, tab, newline), the strings input must be stored and the string built in memory.
Continue reading →

Posted in Lesson | Leave a reply

The Sum of the Integer’s Digit – Solution

Posted on July 8, 2023 by dgookin
Reply

The challenge for this month’s Exercise is to tally the digits in an integer, reporting the sum. You must use math and not cheat by looking at the old solution, which I didn’t. Promise.
Continue reading →

Posted in Solution | Leave a reply

Using scanf() to Build a String – Part I

Posted on July 8, 2023 by dgookin
Reply

The scanf() function is useful for teaching, but it’s a booger. I avoid it outside of demonstration purposes. But it does provide good fodder for training beginning programmers to think about stream I/O.
Continue reading →

Posted in Lesson | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Ctype Function: isxdigit()
  • Ctype Function: ispunct()
  • Ctype Functions: isascii() and iscntrl()
  • That Series That Lacks a Name but Equals 5e – Solution
  • Ctype Functions: isblank() and isspace()

Recent Comments

  • dgookin on That Series That Lacks a Name but Equals 5e – Solution
  • Chris Webb on That Series That Lacks a Name but Equals 5e – Solution
  • Chris Webb on That Series That Lacks a Name but Equals 5e – Solution
  • Chris Webb on That Series That Lacks a Name but Equals 5e – Solution
  • Chris Webb on Ctype Functions: isblank() and isspace()

Meta

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

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress