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 →

A Nifty Random Number Trick

Posted on October 22, 2022 by dgookin
Reply

I don’t believe I’ll ever absorb all the wondrous potential of Linux/Unix. Case in point is the /dev/random file. It’s exactly what the name implies: random stuff. And you can use this nifty file in your C programs to generate random values.
Continue reading →

Posted in Lesson | Leave a reply

GMP Integers and Math

Posted on October 15, 2022 by dgookin
Reply

Continuing from last week’s Lesson, just as you can’t use the equal sign to assign an mpz_t huge integer value, you can’t use the standard arithmetic operators to do math — huge math. Nope, you must use special GMP library functions to do the math.
Continue reading →

Posted in Lesson | Leave a reply

Playing with Ha-Yuge GMP Integers

Posted on October 8, 2022 by dgookin
Reply

I’ve written a few books on using external libraries, which I shamelessly plug later in this post. After confirming that the library is installed (see last week’s post), the next step isn’t to code, but rather to peruse the online documentation, the API or Application Programming Interface.
Continue reading →

Posted in Lesson | Leave a reply

Palindromic Numbers – Solution

Posted on October 8, 2022 by dgookin
3

The challenge for this month’s Exercise is to output the first 100 palindromic numbers, which are integers that reflect the same digits on either side. Rather than devise a complex mathematical equation to determine these values, I cheated.
Continue reading →

Posted in Solution | 3 Replies

Really Ha-yuge Integers

Posted on October 1, 2022 by dgookin
Reply

Unlike real numbers, integers are stored in binary as-is: The bits are read and values set. The only limit on an integer’s value is on the number of bits in the binary chunk — the bit width — which sets the value’s range, positive and negative or just positive.
Continue reading →

Posted in Lesson | Leave a reply

Palindromic Numbers

Posted on October 1, 2022 by dgookin
Reply

Difficulty: ★ ★ ★ ☆

I think most kids delight at discovering the palindrome, where a word or phrase contains the same letters read forward or backwards. For example, racecar, which is really two words but never mind! Imagine how such fun can be spoiled by applying the same rule to a number.
Continue reading →

Posted in Exercise | Leave a reply

Reversing a String

Posted on September 24, 2022 by dgookin
Reply

The C language is weak when it comes to strings. Even the paltry assortment of string.h manipulation functions lacks quite a few tricks that are readily available to other languages. Among them is a function to reverse a string. So why not code your own?
Continue reading →

Posted in Lesson | Leave a reply

Vertical Table Output

Posted on September 17, 2022 by dgookin
Reply

Generating a table where the items march left-to-right and then down the page is uncomplicated with stream output. What’s more difficult is outputting a table where the data drops in columns top-down before going left-to-right. Performing this feat requires no screen/cursor manipulation, only clever coding.
Continue reading →

Posted in Lesson | Leave a reply

Generating a Table from Stream Output

Posted on September 10, 2022 by dgookin
Reply

This month’s Exercise searched for and output the first 100 cyclops numbers. But instead of spewing them out in a long column, my solution set them in a table. The values marched across the screen in neat rows. This trick is rather easy to accomplish, but in my solution I wanted some flexibility with the column number.
Continue reading →

Posted in Lesson | Leave a reply

Cyclops Numbers – Solution

Posted on September 8, 2022 by dgookin
3

I hope this month’s Exercise didn’t terrify you. I remember seeing The Seventh Voyage of Sinbad when I was a kid. The cyclops bothered me so much I asked my mom questions about him for a month.
Continue reading →

Posted in Solution | 3 Replies

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