Introduction of C programming | Learn C programming simple or basic tutorial

C is the programming Language.It was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs.As we know that computers only understand binary language and it was difficult for us to understand, therefore we needed a language which could easily understand the computer and we also understood easily so that the C programming was developed . Although quite a language like this has been developed but its equation has not been able to have any language so far.It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. Despite its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant and portably written C program can be compiled for a very wide variety of computer platforms and operating systems with few changes to its source code. The language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers. Some of the Example's that uses 'C Programming' are is below:-
  1. Operating System (Unix).
  2. Compiler
  3. Assembler
  4. Networks drivers and much More.
                                         


Characteristics of C language:-

  • C is the middle level language. Middle level language drives its simplicity from the high level language and its programming capacity from low level language.
  • c is very easy language.it is  consenting only 32 reserved words
  • C is used to solved various important problems like system booting, operating system design and much more.

C tokens:-

C tokens is the smallest and basic unit  of a C program. there are several kind of Tokens they are as follows:
  1. Keyword
  2. Identifiers
  3. Constant
  4. Constant 
1. Keywords:-  
                          they are also known as reserved word. there are 32 types of keywords.
 they serve for the pacific purpose and can not be used else where .some of c keywords are given below in the table.
int
long
while
char
void
goto
float
main
if
double
Size of
else
short
do
continue
break
for
switch
while
Do while
extern
union
static
Unsigned

   

2. Identifiers:-

                           Identifiers is a name given to the variable ,function by the user. identifiers follows some rules they are follow.

Rules:-

  • the name of the Identifiers can not be same as the name of the keywords.
  • No special character other than underscore can be used as identifiers name.
  • Identifiers name can not be started with a digit.
  •  We can Always start the name of identifiers Alphabets as well as with underscore. 
Examples:
                              Abc     ->   valid
                              Cd123   ->   valid
                                _abc ->  valid
                            @hello -> invalid
                               12a    -> invalid  

3. Constant:-

                          constant  in  ‘C’ something which value cannot be changed . there are various type of constant.constant is like normal variable whose value cannot be changed through out of the program.
constant can be declared as :-> constant  int a;
  1.  integer constant
  2. floating constant
  3. character constant
  4. string constant

(i) integer constant:-

                                    An integer constant numerical constant without any fraction exponent part.
example:- -7,3,103

Rules:-

  • An integer constant must have at least one digit.
  • It should not have decimal value .
  • It could be either positive or negative.
  •  No comma(") os blank are allowed in integer constant.
  • If no sign is preceding of the value it is assume to be the positive.

(ii) floating constant:-

                                    It is also known as real constant. real constant is a numerical constant that constant decimal expansion value.
example: - 35.36,42.66, 35.00

Rules:-

  • It must have a decimal value.
  • It can be positive and negative
  • If no sign process the value then it is considered as a positive 
  • No comma and blanks are allowed

 (iii) character constant :-

                                           A character constant is a constant which use single character enclosed in single quotes. a character constant can have alphabet, numeric value or escape sequence.
Example:- 'A','1'

Rules:-

  • A single character or a digit or and special symbols in closed with in single quotes.
  • Maximum length of character constant is one character.

(iv) string constant:-

                                 String constant are those constant which contained A sequence of character enclosed in double quotes(" ").
Example:- "hello", "name".


If you liked this post, you must share your friends and if you have any questions related to this post, you can ask us by comment and we will reply you fast.

Previous
Next Post »