
Learn Programming in C - Basics, Concepts, and Importance
"Discover the fundamentals of programming in C, including its robust qualities, fixed values, constant types, variable rules, and basic data types. Explore the significance and versatility of C language for efficient and fast code development."
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
PROGRAMMING IN C BY T.R.B.VIDHYA ASSISTANT PROFESSOR DEPT.OF COMPUTER SCIENCE, IT& APPLICATIONS SHRIMATI INDIRA GANDHICOLLEGE TIRUCHIRAPPALLI 620 002.
Importance Importance of C language of C language C has many desirable qualities It is a Robust language . Which has set of built-in functions . It is an efficient and fast . It has variety of data types and powerful operators. There are only 32 key words in C. It is highly portable. It is well suited for structure programming . It has an ability to extends itself. Here the programming task becomes simple because of large number of functions. It is a case sensitive language
In C has a fixed value which do not change during execution of a program. There are several types of constant such as integer constant and Real Constants. Integer constants means sequence of digits. Eg. 123, -321, 0 etc.
Real constants It consists of numbers containing fractional parts like 17.548. It has whole number followed by a decimal point and the fractional part. Eg. 215.0, 9.5. In exponent form mantissa exponent eg. 0.65e4, 3.18e3 etc. Single Character constants. It means a single character enclosed with in a pair of single quote marks. Eg 5 , X , ; For this the output will be in ASCII values the character which is quoted with single marks. String Constants. It is sequence of characters enclosed in double quotes. Which is printed the output results as it is given . Eg Helllo , 1987 , ? .
. Variables is a data name that may be used to store a data value. It has change the values during the execution of a programme. Eg. Average, Height., T_raise. It consists of letters, numbers and Underscore (_) characters. Rules They must begin with a letter underscore may be first character. ANSI standard recognizes a length 31 characters. First eight characters are significant Upper case and Lower case are significant. It should not be key word. White space is not allowed.
The concept of trigraph sequence to provide a way to enter certain characters that are not available on some key words. Each trigraph sequence consists of 3 characters (Two question mark followed by another character). Eg ?? = means # number sign.
Basic data types The variety of data types in C : Primary or Fundamental data types Derived data types. User define data types. All C compilers support many fundamental data types such as integer (int) character (char), floating point (float), double precision floating point (double) and void. Data type Range of types char -128 to 127 int -32, 768 to 32,767 float 3.4e-38 to 3.4e+e38 double 1.7e-308 to 1.7e+308
The Character that can be used to form words, numbers and expression depend upon the computer on which the program is run. A subset of characters is available that can be used in many computers. The characters in C are grouped into Letters (A Z) (a .z) Digits (0 9) Special Characters ( . , : ; - $ & * ( ) @ # ! ~ ` etc) White spaces (Blank Spaces, Tab etc.) The compiler ignores white spaces unless they are part of a string constant .
Identifier . Identifier means which refers the names of variables, functions and arrays. These are used define names which consists of a sequence of letters and digits, with a letter as a first character. Both upper and lower case letters are permitted. The underscore character is also permitted which used as a link between two words.
Rules Rules First character must be an alphabet (or underscore). Must consists of only letters , digits or underscore Only first 31 characters are significant. Cannot use a key word. Must not contain white space
A function is a subroutine that may include one or more statement designed to perform a specific task . To write a C program first create functions and then put them together. Documentation Section Link Section Definition Section Global declaration section Main() Function Section { Declaration Part Executable Part } Subprogram Section { Function 1 Function 2 (User-defined functions) - - Function n }
Documentation Section consists of a set of comment lines such as name of the program, author & other details etc. The link section provides instructions to the compiler to link functions from the system library. The definition sections defines all symbolic constants. There are some variables that are used in more than one function. Such variables are called Global variables which are declared in the Global declaration section that is outside of all the functions. This section also declares all the user defined functions .
Every C program must have one main() function. It has two parts. Declaration Part which declares all the variables used in the executable part. There is at least one statement in the executable part. The above two parts must appear between the opening and the closing curly braces. Here each statement is terminated with a semicolon(;). The subprogram section contains all the user defined function that are called in the main function.
In a passage of text , individual words and Punctuation marks are called are tokens. Here smallest individual units are known as C Tokens. C has six type of tokens. Key words Identifiers Constants Strings Special symbols Operators
Every C word is classified as either a key word or an identifier . All the key words have fixed meanings which cannot be changed. Key words serve as basic building blocks for program statements. There are 32 key words which must be written in lower case. Some compliers may use additional key word. Identifier Identifier means which refers the names of variables, functions and arrays. These are used define names which consists of a sequence of letters and digits, with a letter as a first character. Both upper and lower case letters are permitted . The underscore character is also permitted which used as a link between two words. Rules First character must be an alphabet (or underscore). Must consists of only letters , digits or underscore Only first 31 characters are significant. Cannot use a key word. Must not contain white space
Constants Constants in C has a fixed value which do not change during execution of a programme. There are several types of constant such as integer constant and Real Constants. Integer constants means sequence of digits. Eg. 123, -321, 0 etc. Strings Single Character constant means a single character enclosed with in a pair of single quote marks. Eg 5 , X , ; For this the output will be in ASCII values the character which is quoted with single marks.
Real constants It consists of numbers containing fractional parts like 17.548. It has whole number followed by a decimal point and the fractional part. Eg. 215.0, 9.5. In exponent form mantissa exponent eg. 0.65e4, 3.18e3 etc. Single Character constants. It means a single character enclosed with in a pair of single quote marks. Eg 5 , X , ; For this the output will be in ASCII values the character which is quoted with single marks. String Constants. It is sequence of characters enclosed in double quotes. Which is printed the output results as it is given . Eg Helllo , 1987 , ? .
Special Special symbols symbols The symbols which are used in C language [ ] { } & # etc Operators Operators + - * / ^ % etc.