Bradford Morgan White: programming

20120613   An Introduction to C, I   ⇢  

C is a computer programming language that was designed for the purpose of implementing system software. Today, it is still used for that task but is also used for implementing application software. C is insanely widely used. C is the bedrock of UNIX, Linu

20120616   An Introduction to C, II   ⇢  

Last time, we got into the absolute basics. This time, let's cover something more useful. A variable is like a letter in algebra. You can make it something other than what it appears to be, and this can be quite useful. Unlike algebra, a variable can be A

20120626   An Introduction to C, III   ⇢  

So, in this installment, let's talk about loops. So far, all you have had is sequences. Programs only consist of sequence, loop, selection, and data. Looking at it this way, you're nearly ready to call yourself a programmer. So, don't get discouraged. A l

20160705   An Introduction to C, IV   ⇢  

Programs are a lot more useful if users can interact with them. It is equally useful to be able to perform specific operations depending upon what input is gained from said users. That's the topic for this entry. There are several methods that can be used

20120710   An Introduction to C, V   ⇢  

As you might imagine, a large series of conditional statements could get really tedious. Imagine a series of 20 if statements... and imagine typing that out. Very quickly, it would become very annoying. For this reason, C has the switch-break. switch

20120728   An Introduction to C, VI   ⇢  

Now for something odd. a = (x > 3 ? 2 : 10); The above means: "if x is greater than 3 then a is equal to 2, otherwise a is equal to 10. Written in a form with which you are already familiar, the above is exactly equivalent to the following: if (x

20120815   An Introduction to C, VII   ⇢  

So far, I have thrown a lot of information at you very quickly. Let's recap with completely useless programs. The character variable type uses 8 bits of memory (one byte). This type is declared with the 'char' keyword. While the character type is used to

20120830   An Introduction to C, VIII   ⇢  

So far, we have already covered the use of the character data type, but what happens when you want to print more than one character to screen? This was strings are for. A string is a series of characters terminated as with a null character. That is, a str

20120910   An Introduction to C, IX   ⇢  

In the last post, I briefly introduced arrays and strings. Let's look a little more closely. #include #include int main(void) { char name1[5] = "Ford"; char name2[4] = "Jim"; char name3[8] = ""; if

20130122   An Introduction to C, X   ⇢  

It's time for a cake walk. Here's an array of integers. int values[10]; int i; for (i = 0;i < 10;i++) { values[i] = 2 * (i + 2); printf("The value at i %d is %d\n", i, values[i]); } That's it. Floats and other data types work p

20150610   An Introduction to C, XI   ⇢  

Some time has passed since I last did anything with my C tutorial. This is largely due to work and having several different projects going at any one time (learning Chinese, developing a hobby OS, a gaming community, etc...). However, I felt that I ought

20150705   An Introduction to C, XII   ⇢  

So, in this part of the C Intro, I would like to say a bit about memory management. VARIABLES In C, there are really only two ways that you can allocate memory. The first and most common way is by declaring a variable. The second way is to explicitly

20150823   An Introduction to C, XIII   ⇢  

We've covered a lot of ground with C so far. The big problem here is that we've not yet covered one of the most common tasks on a UNIX system. We have not covered files. So, let's look at files. For file I/O in C, you need a file pointer. We declare a fi

⇠ back

© MMIX - MMXXVI, Bradford Morgan White
Licentiam Absurdum