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 ternary_out() Function

Posted on June 13, 2020 by dgookin
Reply

I believe my approach was okay for generating ternary (base 3) numbers, but for some reason I couldn’t get my algorithm to work. From last week’s Lesson, here’s what I tried:
Continue reading →

Posted in Lesson | Leave a reply

Getting to Euler’s Number – Solution

Posted on June 8, 2020 by dgookin
Reply

The challenge for this month’s Exercise is not only to calculate Euler’s number, e, but to count how many loops a program must endure before your e value calculation matches the defined constant M_E. I hope you didn’t find this challenge too difficult.
Continue reading →

Posted in Solution | Leave a reply

Dreaming of the ternary_out() Function

Posted on June 6, 2020 by dgookin
Reply

To generate a string of digits representing a value in a specific power base, such as base 3 (ternary), you need a power table. Using this power table, you can translate any positive integer into a string representation of the number in the given base. Sounds complex. Is complex.
Continue reading →

Posted in Lesson | Leave a reply

Getting to Euler’s Number

Posted on June 1, 2020 by dgookin
6

I enjoy reading about and studying mathematics. One of my favorite books is A History of π. I’ve used this book to inspire my Pi Day (March 14) programs. It’s fascinating stuff.
Continue reading →

Posted in Exercise | 6 Replies

Powers of Three

Posted on May 30, 2020 by dgookin
4

When the math nerds refer to a counting system, they use the word base. “We count in base 10,” they proclaim, adding, “Decimal” to sound important. Surely, these are the miracles of mathematics.
Continue reading →

Posted in Lesson | 4 Replies

Degrees to Radians to Degrees

Posted on May 23, 2020 by dgookin
Reply

The C language uses radians instead of degrees when calculating angles. Humans should use radians as well, as they’re logical and easy to work with (radians, not humans). What surprises me, however, is that the C library lacks a defined constant for making the degree-radian conversion.
Continue reading →

Posted in Lesson | Leave a reply

Creating a File “in the Raw” – with Permissions

Posted on May 16, 2020 by dgookin
Reply

Way back in April, I concluded my series on the “raw” file functions with a program that created a new file — but one that had no permissions. Thanks to input from readers and research into file-permission functions, I have a solution to the puzzle.
Continue reading →

Posted in Lesson | Leave a reply

Changing a File’s Permissions

Posted on May 9, 2020 by dgookin
Reply

In Unix-like operating systems, the chmod shell command alters a file’s permissions. From the C library, the chmod() function does the same thing.
Continue reading →

Posted in Lesson | Leave a reply

Tic-Tac-Toe Evaluation – Solution

Posted on May 8, 2020 by dgookin
Reply

The insidious part of this month’s Exercise is writing a function that doesn’t count a stalemate as a win. It’s what happened to me for my first draft of a solution.
Continue reading →

Posted in Solution | Leave a reply

Examining File Type and Permissions

Posted on May 2, 2020 by dgookin
Reply

The value returned as a file’s inode mode is difficult to interpret, as covered in last week’s Lesson. That is, unless you use the macros and defined constants available in the sys/stat.h header file.
Continue reading →

Posted in Lesson | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Cooked or Raw?
  • Is It a “Real” Triangle? – Solution
  • Getting and Setting the File Position Indicator
  • Is It a “Real” Triangle?
  • A Colorful Hexdump

Recent Comments

  • dgookin on Is It a “Real” Triangle? – Solution
  • Chris Webb on Is It a “Real” Triangle? – Solution
  • dgookin on A Colorful Hexdump
  • Chris Webb on A Colorful Hexdump
  • dgookin on Code Page 437

Meta

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

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress