C Programming/Before You Start

From Wikiversity
Jump to navigation Jump to search
Completion status: this resource has reached a high level of completion.

Objective

[edit | edit source]
  • Get an overview of C and its benefits.
  • Learn about the creation of C.
  • Learn the uses of C.
  • Learn and acquire the tools you'll need for this course.
  • Understand the need to complete the assignments.
  • Understand the need to pace yourself.
  • Have fun!

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]
Ken Thompson (left) with Dennis Ritchie (right, the inventor of the C programming language).

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 was once widely used for application development. However, the popularity of C for application development has been declining in recent years due to the avaliability of high-level programming languages (such as Python) and the speed of modern day computers. However, C has been and continues to be used in low-level applications, such as the development of kernels, filesystems and device drivers. All of which are still fundamental parts of modern day operating systems.

Tools You'll Need

[edit | edit source]

A compiler is a computer program that takes source code and translates it into machine instructions that can be interpreted by the machines processor. 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. It is recommended to use GCC, a modern day, free and open-source (FOSS) compiler. Alternatively, Clang, a compiler based off the LLVM backend can be used. GCC is the compiler of choice of most GNU/Linux Distributions and Clang is the compiler of choice for MacOS and most *BSD systems. Clang is oftentimes more efficient then GCC.

An IDE (Integrated Development Environment) is a software package that includes all the basic programming tools a developer may need. Such as a text editor with synatx highlighting, or an integrated compiler/interpreter for quickly running and testing programs. An IDE such as VS Code is recommended for beginner programmers. Others, typically those who are mode advanced, may choose to use other editors such as Vim

Ever since ANSI C. C and it's features and syntax has been standadised by the ISO. All examples aim to be C17 (as of writing the latest revision) compliant.

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]
  • Name a benefit gained when learning C?
  • Give a short summary on the creation of C.
  • Why was C famous irrespective of availability of other languages?
  • Where is C used? What applications use C?
  • Did you install a C compiler? If so, what's its name? Do you know how to use it?
  • Did you faithfully complete this assignment?
  • Give your suggestions that C is useful in today's world or not?