I am proficient in several programming languages, but my favorite has to be C. Developed in the 1970s as a systems programming language, C remains one of the most popular programming languages in 2021. If you'd like to explore several features of the C programming language, start with these popular articles from the last year:
Short option parsing using getopt in C
You can make your program much more flexible if it responds to the user every time it runs. Let your user tell your program what files to use or how to do things differently. And for that, you need to read the command line. This article shows you how to read the command line directly using argv
and use short command-line options using getopt
.
Position text on your screen in Linux with ncurses
Most Linux utilities just scroll text from the bottom of the screen. But what if you wanted to position text on the screen, such as for a game or a data display? That's where ncurses
comes in.
Get started programming with DOS conio
C isn't just for Linux. You can find C on many operating systems, including DOS. The standard way for many C programmers to control console input and output was with the conio
library. Learn how to use conio
to update the console from DOS programs, including text color and text windows.
Write a chess game using bit-fields and masks
The standard way to associate information in a C program is by using a structure that combines two or more related fields. For example, you might use a structure to track chess pieces on a board. But there's a more straightforward way to track the same information while using less data and memory. Using binary bit-fields and masks, you can store a single value to identify the pieces and color in each square.
5 common bugs in C programming and how to fix them
Even the best programmers can create programming bugs. Depending on what your program does, these bugs could introduce security vulnerabilities, cause the program to crash, or create unexpected behavior. But with a little extra code, you can avoid the most common and most serious C programming bugs. Here are five bugs that can break your application and how you can avoid them.
With only a little knowledge of C, you can do a lot. Explore new ways to add features to your next C programming project.
Comments are closed.