Join Dan Gookin for an in-depth discussion in this video Programming overview, part of Up and Running with C.
- Like anything new when you set out to program you find yourself surrounded with strange and potentially weird terms and fancied jargon. In this movie I review those terms as well as present an overview of the entire programming process. While I'm certain that you're eager to get started with writing code and you may have already viewed a later movie in this course it's important to know a few key terms and programming concepts. Programming is where you create software, software controls hardware, which is the physical part of an electronic device such as a computer, phone, tablet, gaming console, microcontroller or some other gizmo.
Those instructions take the form of a programming language. For this course that language is the C programming language which was developed back in the early 1970s. That's pretty old and in fact over time the C programming language has been considered the Latin of programming languages. Unlike Latin, C isn't dead, lots of C programming still goes on despite newer and fancier programming languages coming along but like Latin, C is the foundation upon which many other programming languages are built.
If you know C you can more easily learn those other languages. In a later movie I'll talk about the programming language's syntax and other rules. But for now know that the code you write is called source code, it's a plain text file that contains the programming language, all formatted and pretty and written properly. The file is saved with a .c filename extension. To create source code you use a text editor, any text editor can do although some editors offer helpful features like color coding, line numbers, syntax checking and other tools.
The source code is then compiled into object code. The program that creates the object code is called a compiler. The traditional name of the C language compiler is CC, which stands for C compiler. The compiler reads the source code file and generates an object code file. Object code files have a .o filename extension and they use the same filename as the original source code file. The next step is called linking.
It's often forgotten because modern compilers both compile and link, but linking is really a separate step. The linker takes the object code file and combines it with C language libraries. The libraries are the work horse of the language. They contain routines, functions that control whatever device you're programming. If all goes well, the end result is a program file. You can then test run the program to make sure that it works the way you want it to. And if not you start the cycle all over again.
Edit, compile and link, test run. All of these tools, the editor, compiler and linker originated at the command prompt or terminal. You can still find them there too, I do a lot of coding at the command prompt because it's quick. More common, however, is to use an IDE or Integrated Development Environment. An IDE combines the tools for editing, compiling, linking and running. It also adds tools for debugging, creating complex programs, graphical tools and other features.
Beneath it all, however, is the humble command line compiler and linker and the process is the same. Edit, compile and link, run. Although in practice you're going to do a lot of repeating and re-working before you get things just right.
- Understanding a C program
- Adding comments
- Using escape characters
- Working with values and placeholders
- Introducing variables
- Making a decision with if
- Adding functions
- Manipulating strings
- Building arrays
- Nesting structures