About a year ago, I wrote a post on reading the command line arguments. It’s a process that takes place all the time, not only when running programs in a terminal window but also for graphical operating systems. Knowing how to manipulate command line arguments is important.
Continue reading
Author Archives: dgookin
Quicksorting Strings, Pointer Edition
I’ll confess that when I use a quicksort to sort and array of strings, I don’t use the C Library’s qsort() function. No, I write my own. The problem is that when sorting an array of strings, the qsort() function’s compar argument is a pain in the butt to craft properly.
Continue reading
Board of Chess – Solution
A chessboard is merely a two-dimensional array — a matrix — one where the rows and columns are the same size. As long as you can write code to output an 8-by-8 board, you can modify the code to reset the board’s size to any value.
Continue reading
Quicksorting Strings
The quicksort deftly handles vast quantities of values. It can also sort strings, but that’s where things can get weird.
Continue reading
Board of Chess
Thanks to Mr. Spock (and God bless you, Mr. Nimoy!), many people think of Chess when they think of computer programming. Unlike mankind’s favorite Vulcan, coding your own computer chess game would be a tremendous undertaking. Even so, you can start with the basics and write a program that outputs a chessboard.
Continue reading
Inside the Quicksort
The Internet is littered with plenty of good explanations of how the quicksort works. The definition at Wikipedia graphically illustrates the process, which is commonly called “divide and conquer.” I’ve stolen the Wikipedia illustration and placed it into Figure 1.
Continue reading
The Quicksort
Computers excel at searching and sorting. That, and they can occasionally screw up a phone bill.
Continue reading
Sorting It All Out
Computers are good at performing repetitive tasks; doing the same boring nonsense over and over. Two great examples are searching and sorting.
Continue reading
Pattern Manipulation – Solution
This month’s Exercise was to create a cycle of numbers, values that repeat within a certain range. Of all the Exercises presented so far on this site, this one probably has the greatest number of solutions.
Continue reading
Other Ways to Fetch the CWD
In last week’s Lesson I mentioned the constant, MAXPATHLEN. Like PATH_MAX, it returns the size of the maximum number of characters allowed in a pathname. Unlike PATH_MAX, however, MAXPATHLEN is defined in the sys/param.h header file, not limits.h.
Continue reading