Browsed by
Category: C Programming

Common C Programming Mistakes

Common C Programming Mistakes

I taught C programming for many years and saw that some mistakes were fairly common, especially among people new to programming. All of these are mistakes according to the C89 standard (referred to as C89 below), but many are still wrong according to any C standard. Note that these specific error messages were generated when compiling with the GCC compiler, so the error messages you will see with a different compiler may vary from these. You can find a video…

Read More Read More

C Application: Choosing an Electrical Plan

C Application: Choosing an Electrical Plan

People learning to program often struggle with how to decompose a problem into the steps necessary to write a program to solve that problem. This is one of a series of posts in which I take a problem and go through my decision-making process that leads to a program. Background: In the spring of 2020, it was time to choose a new electrical plan and with my current provider I basically had two options. My home has a smart meter,…

Read More Read More

C Programming: A Self-Learning Guide

C Programming: A Self-Learning Guide

The purpose of this page is to guide someone wishing to learn to program using the C programming language, specifically the ANSI Standard of 1989. Each section consists of a link to a video that teaches an element of the language sample problems for you to try. My solutions to the problems can be found at the bottom of the page. It’s OK if your solution isn’t the same as mine. Some sections also include a link to a video…

Read More Read More

C Programming: Pointers

C Programming: Pointers

Introduction A pointer is a variable whose value is the address of another variable. Hence we think of them as pointing to another variable. Knowing the specific address of a variable is typically not what we are interested in. Instead, we can use the pointer to access the value of the variable whose address is stored in the pointer variable. Pointer variables have their own type, which should match the type of variable that they point to. For example, a…

Read More Read More

C Application: Simulating a Perfect Shuffle

C Application: Simulating a Perfect Shuffle

People learning to program often struggle with how to decompose a problem into the steps necessary to write a program to solve that problem. This is one of a series of posts in which I take a problem and go through my decision-making process that leads to a program. Background: I once attended a presentation by an amateur magician in which he stated that performing 8 perfect shuffles in a row on a deck of 52 cards returned the deck…

Read More Read More