C PROGRAMING LANGUAGE is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972. In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available description of C, now known as the K&R standard.
The UNIX operating system, the C compiler, and essentially all UNIX application
programs have been written in C. C has now become a widely used professional
language for various reasons: If you Want to Read This Article In Hindi Then Click Here.
- Easy to learn
- Structured language
- It produces efficient programs
- It can handle low-level activities
- It can be compiled on a variety of computer platforms
Facts about C Language
- C was invented to write an operating system called UNIX.
- C is a successor of B language which was introduced around the early 1970s.
- The language was formalized in 1988 by the American National Standard Institute (ANSI).
- The UNIX OS was totally written in C.
- Today C is the most widely used and popular System Programming Language.
- Most of the state-of-the-art software have been implemented using C.
- Today’s most popular Linux OS and RDBMS MySQL have been written in C.
Why We Should Use C?
C was initially used for system development work, particularly the programs that
make-up the operating system. C was adopted as a system development
language because it produces code that runs nearly as fast as the code written
in assembly language. Some examples of the use of C might be:
- Language Compilers
- Text Editors
- Operating Systems
- Print Spoolers
- Network Drivers
- Modern Programs
- Language Interpreters
Environment Setup FOR C LANGUAGE
If you want to set up your environment for C programming language, you need
the following two software tools available on your computer,
(a) Text Editor and
(b) The C Compiler
This will be used to type your program. Examples of a few editors include
Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi.
The name and version of text editors can vary on different operating systems.
For example, Notepad will be used on Windows, and vim or vi can be used on
Windows as well as on Linux or UNIX.
The files you create with your editor are called the source files and they contain
the program source codes. The source files for C programs are typically named
with the extension “.c”.
Before starting your programming, make sure you have one text editor in place
and you have enough experience to write a computer program, save it in a file,
compile it and finally execute it.
The source code written in source file is the human readable source for your
program. It needs to be “compiled” into machine language so that your CPU can
actually execute the program as per the instructions given.
The compiler compiles the source codes into final executable programs. The
most frequently used and free available compiler is the GNU C/C++ compiler,
otherwise you can have compilers either from HP or Solaris if you have the
respective operating systems.
Before we study the basic building blocks of the C programming language, let us
look at a bare minimum C program structure
A C program basically consists of the following parts:
- Preprocessor Commands
- Statements & Expressions
Let us look at a simple code that would print the words “Hello World”:
/* my first program in C */
printf(“Hello, World! \n”);
Let us take a look at the various parts of the above program:
- The first line of the program #include is a pre-processor
command, which tells a C compiler to include stdio.h file before going to
- The next line int main() is the main function where the program execution
- The next line /…/ will be ignored by the compiler and it has been put to
add additional comments in the program. So such lines are called
comments in the program.
- The next line printf(…) is another function available in C which causes the message “Hello, World!” to be displayed on the screen.
- The next line return 0; terminates the main() function and returns the value 0.
Compile and Execute C Program
Let us see how to save the source code in a file, and how to compile and run it.
Following are the simple steps:
- Open a text editor and add the above-mentioned code.
- Save the file as hello.c
- Open a command prompt and go to the directory where you have saved
- Type gcc hello.c and press enter to compile your code.
- If there are no errors in your code, the command prompt will take you to
the next line and would generate a.out executable file.
- Now, type a.out to execute your program.
- You will see the output “Hello World” printed on the screen.
Basic C Programming MCQ
Who is the father of C language?
C programming language was developed in
1972 at American Telephone & Telegraph Bell Laboratories of USA.
The Unix operating System Written in
C is a
Human Language to Machine Language
c language was formalized in
1988 by the American National Standard Institute (ANSI)
Full form of ANSI
American National Standard Institute
When was ANSI created?
14 May 1918
Who created ANSI?
In 1918, ANSI was originally established as the American Engineering Standards Committee (AESC)
How long will it take to learn C language?
AROUND 40 HOURS WITH PRACTICAL
Is C hard to learn?
C IS FIRST LANGUAGE TO LEARN , IT INCLUDES ALL THE BASE . SO IF YOU ARE NEW THEN YES IT IS DIFFICULT BUT IT IS WORTHY …
Can I learn C in a week?
That is simply not possible.
Is C still in demand?
YES WHY NOT
How can I learn C at home?
JUST STAY WITH US
Why C language is called C?
It was named ‘C’ because many of its features were derived from an earlier language called ‘B’.