C Programming/Before You Start
Objective[edit | edit source]
Lesson[edit | edit source]
Overview[edit | edit source]
If you have never programmed before or you want a refresher on C, then this course is for you! The C language provides a basis for understanding core programming concepts and a general feel of how the computer works. If you know how to program in C, you'll be able to transition to other C-like languages like C++, Java, and C# with relative ease. You aren't just limited to learning programming languages either, because a lot of the concepts taught in this course are associated with the field of computer science.
The Birth of C[edit | edit source]
The C language didn't just happen over night. Time, people, and events were needed in order for this language to become a reality. So, how exactly did C come to its existence? In the early 1960's the idea of time-sharing became powerful. Large amounts of money and manpower were spent on programs that allowed a large number of people to access one computer from a terminal and use some of its resource, all at the same time! One computer was able to act like 100, allowing places like Universities to efficiently give its students access to a computer at a reasonable cost. Eventually, a time-sharing operating system called Multics became prominent in the time-sharing industry. Although Multics was revolutionary in some ways, it had many problems. It's code was large and complex, which meant it wasn't very efficient to modify the operating system. In the early 1970's, the people at Bell Labs got frustrated and fed up with Multics, so they decided to create their own operating system. Today, this operating system is known as Unix. It was originally written in assembly, which led to some problems, since it isn't very portable. The solution to their problem was going to be a programming language called B, but it had some problems and inefficiencies. Dennis Ritchie created a newer and better version of B that was called C; C being a lot more powerful than B. C was so powerful, that it was able to do the job and Unix was mostly rewritten in C. This allowed Unix to be ported to many different computers with relative ease. Soon C was used for other jobs, slowly becoming one of the most influential languages ever.
C's Uses[edit | edit source]
C is widely used in education, in application programs like text editors, windows based applications, in games like Quake III, in calculations like finding interest, and for sorting, maintaining and organizing large amounts of data. C programs are used in engineering applications like plotting of curves, integration, game development and many more. C has been used in very complex things also, e.g. Operating systems like GNU/Linux , Unix. Microsoft/Windows and other Unices (SunOS, FreeBSD, et al) were also written partly in C.
Tools You'll Need[edit | edit source]
A compiler is a program that takes source code and turns it into an executable file. To learn C, you'll need a computer and operating system that has a C compiler. Generally, these can be platform specific, so they will vary in usage and performance. A list of C compilers can be found here. Each compiler has its advantages and disadvantages, for example some compilers may cost money, but you should be able to find free ones. The most popular C compiler is GCC (GNU Compiler Collection), it is usually pre-installed in GNU/Linux. If not, you can install it using your respective package manager. An IDE (Integrated Development Environment) is a software package that includes all the basic programming tools a developer may need. While not strictly necessary, all but the most proficient programmers may find it an invaluable resource. When downloading and installing the compiler or IDE, you'll need to strictly follow its manual on how to setup and use the compiler or IDE. If it has a poor manual, it is advised to beware of it. Many Windows IDE's uses GCC as their standard compiler.
If you choose not to install an IDE (which comes equipped with its own source code editor), you'll need a program to write source code. Generally, any plain-text editor, such as Windows Notepad, will do. (The key here is plain-text; you do not want to use a program that inserts 'invisible' formatting symbols, as they will cause compilation errors.)
As time passed and C became more widely used, it started to diverge from K&R C (often refereed as original version of C, which was invented by Ken Thompson and Dennis Ritchie), and branched into different standards. The first widely recognized standard was ANSI C (aka C89, C90, ISO C), declared by the American National Standards Institute (ANSI) in 1989, which was approved by the International Organization for Standards (ISO) in 1990. More recent standards are the C11 and C17 standards, which were approved in 2011 and 2018 (prepared in 2017), respectively. Many C programs were written following the ANSI C standard.
Now you have all the tools you need to start using C.
Assignments Are Good For You[edit | edit source]
This course provides many questions and exercises that test to see if you've understand the lesson. They are all contained with a section of the lesson called "Assignments" and are found at the end of the lesson. Although you're not required to do them, it's recommended that you complete the given assignments.
Have Fun![edit | edit source]
Finally, I would like to tell you that programming can be a lot of fun. If you have that constant urge to learn, to know more, if you are inquisitive, then learning C is not only a good experience, it is also fun. Some words of wisdom, try to pace yourself when using this course. Going too fast or too slow can reduce the will to complete this course.
Assignments[edit | edit source]