



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This Chapter includes the basic structure of C Programming Language with examples which will make you to understand the programming language in easier and simpler way.
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!
“C” is a high-level, structured and machine independent language. It allows software developers to develop program without taking care of the hardware on which the software can run.
In earlier days there was only one programming language known as ALGOL found in 1960. In 1967 Martin Richards developed a language called BCPL (Basic Combined Programming Language) for writing system software. In 1970 Ken Thompson created a language using many features of BCPL and called it simply “B” at Bell-Laboratories. Both BCPL and B are “typeless” programming language. Typeless Language: The language which does not have any data-type. In 1972 Dennis Ritchie at Bell-Laboratories created another language by using ALGOL, BCPL and B. The language called “C”. The language became more popular after publication of book “The C Programming Language” by Brian Kernigham and Dennis Ritchie in 1978. The book was so popular at that time, so C was known by another name called ‘K and R C’. To assure that C language maintains standards, in 1983, American National Standard Institute (ANSI) created a committee to define a standard for C. The
c o m m i t t e e
approved version of C in1989, which is also known as ANSI C nowadays.
Basics of C:
Format of C:
main() Function name
{ Start of the Program
Program Statements
} End of Program
1967 BCPL Martin Richards 1970 B Ken Thompson 1972 C Dennis Ritchie 1978 K & R C Kernigham & Ritchie 1989 Standards by ANSI C 1990 Approved by ISO (C89) 1999 Standards Updated (C99)
printf(“ I see, I remember”);
}
Escape Sequences in C :
\n ---- New line.
\t ---- horizontal tab.
\ ---- Backslash.
\’ ---- Single quotation.
\” ---- Double quotation.
Eg:
void main() { printf(“ I am studying in BCA”); printf(“\n My subject is C”); printf(“\t I am learning escape sequences”); }
Output will be:
I am studying in BCA My subject is C I am learning escape sequences
Documentation Section Link section Definition section Global declaration Section main function section { Declaration Part Executable Part } Subprogram Section Function 1 Function 2 Function n (User Defined functions)
The documentation section consists of a set of comment lines giving name of program, the author and other details. The link section includes instructions to compiler to link functions from the system library, you can write #include directive in this section. In definition section all the symbolic constants like PI can be defined. We can use #define directive here the global variables. There are some variables which can be used in more than one Function, such variables are called as global variables. This section also declares all user-defined functions. Every C program required must have one main () function section. This section contains two parts, declaration and execution part. Declaration section part declares all the variables used in execution part. The program execution begins at the opening brace and ends at the closing brace. The closing brace of the main function section is the logical end of the program. All the statements in the declaration and executable parts end with a semicolon(;).
#include<stdio.h> #include<conio.h> void main() { printf(“Hello World!”);
getch(); }
Hello World!