c language learn c langauge in 7 days


c language -1st day

History of C
·        Martin Richards                         
-Developer of BCPL
-Basic Combined Programming Language

·        Ken Thompson
-Worked in Bell labs
-Developer of B language
-Also Developer of UNIX Operating System
-He also developed first master level chess called Belle in 1980.

·        Dennis Ritchie
-Developer of C language
-In 1972
-At AT & T’s  LABs,USA
-Co-Developer of UNIX Operating System

Introduction of C Languages
C programming is a popular computer programming language which is widely used for system and application software.The C programming 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.

     Easy to learn
     Structured language
     It produces efficient programs.
     It can handle low-level activities.

Why C  language is so Important ??
-         Oracle is Written in C
-         Core libraries of android are written in c
-         MySql is Written in C
-         Almost every Device Drivers is written in c
-         Major part of Web Browser is written in c
-         Unix operating System is Written in c
-         C language is world’s most popular programming language
For Students
Ø C is important to build programming skills.
-Language is medium to express our Thoughts and Thinking.
           -C Covers basic features of all programming language.
           - C is the most popular language for hardware dependent

Basic Structure of C Programming
1)    Documentation Section
In this section, we comment or note down information that used in future. comment does not show in output.
2)    Link Section
In this section, we used to include header files which contain pre-defined function.
3)    Definition Section
In this section, we used symbolic Constant which is used in program.
4)    Global Declaration Section
In this section, We declare global Variable which is used in whole program anywhere.
5)    Main Section
This Section is essential section. It is divided in two parts
(i)                Declaration Part
(ii)              Executable Part
6)    Subprogram Section
In this section, we used different function that used in whole program.

Variables are memory location in computer's memory to store data. To indicate the memory location, each variable should be given a unique name called identifier. Variable names are just the symbolic representation of a memory location.
Int num;
int -(Data Type)
num –(Variable Name) 
Rules for writing variable name in C
     Variable name can be composed of letters (both uppercase and lowercase letters), digits and underscore '_' only.
     The first letter of a variable should be either a letter or an underscore. But, it is discouraged to start variable name with an underscore though it is legal. It is because, variable name that starts with underscore can conflict with system names and compiler may complain.
     There is no rule for the length of length of a variable. However, the first 31 characters of  a variable are discriminated by the compiler. So, the first 31 letters of two variables in a program should be different.
Data types
Datatypes is predefined word which used to define how much space should be allocated and which data to be store in variable.

Types  of Datatype:-
-Integer type
-Character type
-float type
-Double type
-union etc.
     Integer data types
Keyword int is used for declaring the variable with integer type.
int var1;
Here, var1 is a variable of type integer.
The size of int is either 2 bytes(In older PC's) or 4 bytes. If you consider an integer having size of 4 byte( equal to 32 bits), it can take 232 distinct states as: -231,-231+1, ...,-2, -1, 0, 1, 2, ..., 231-2, 231-1
     Floating types
Variables of floating types can hold real values(numbers) such as: 2.34, -9.382 etc. Keywords either float or double is used for declaring floating type variable.
float var2;
double var3;
Difference between float and double
Generally the size of float(Single precision float data type) is 4 bytes and that of double(Double precision float data type) is 8 bytes. Floating point variables has a precision of 6 digits whereas the the precision of double is 14 digits.

     Character types
Keyword char is used for declaring the variable of character type.
char var4='h';
The size of char is 1 byte. The character data type consists of ASCII characters
Preprocessors in C
The C Preprocessor is not part of the compiler, but is a separate step in the compilation process. In simplistic terms, a C Preprocessor is just a text substitution tool and they instruct compiler to do required pre-processing before actual compilation
All preprocessor commands begin with a pound symbol (#). It must be the first nonblank character, and for readability
Substitutes a preprocessor macro
Inserts a particular header from another file
Undefines a preprocessor macro
Returns true if this macro is defined
Returns true if this macro is not defined
Tests if a compile time condition is true
The alternative for #if
#else an #if in one statement
Ends preprocessor conditional
Prints error message on stderr
Issues special commands to the compiler, using a standardized method

Library in C
The stdio .h header defines three variable types, several macros and various functions for performing input and output.
The math.h header defines various mathematical functions.
The time.h header defines four variable types,  various functions for manipulating date and time.
The string .h header defines one variable type and various functions for manipulating arrays of characters.
The stdlib .h header defines four variable types and  various functions for performing general functions.
C Programming Input Output (I/O)
ANSI standard has defined many library functions for input and output in C language. Functionsprintf() and 
scanf() are the most commonly used to display out and take input respectively
Conversion format intger "%d" is used in case of intger
Conversion format float "%f" is used for floats to take input and to display floating value of a variable.
Conversion format string "%c" is used in case of characters.

 to read 1st day secound part clik below link

to learn second day c langauage click below button

c langauge 2nd day


No comments