Skip to main content

C tutorial for complete beginners(intro to C language)



     Any programming language has four important aspects viz
* The way it stores data
* The way it operates upon this data
* The way it accomplishes input and output
* The way lets u control the sequence of execution of program. 

What is C? 

C was developed by Ritchie in 1972 at AT and T's Bell laboratories, USA. Interestingly no one pushed it and there was no advertisement made but still programmers of the time preferred it over the older ones like FORTRAN. It was popular due to its simplicity, reliability and it's ease. 

Inventor of C language,   Dennis Ritchie

Why Still C in 2019? 

As per today's opinion that C has been superseded by C++, C# and java one must still start his programming journey with C due to following reasons:
1. C++and C# use object oriented programming and basic programming skills         of C. 

2. Mobile devices are today's rage and device like watches, camera, ovens, tvs         are getting smarter day by day. This smartness comes from the                             microprocessor installed in them. This microprocessor has limited memory        space for the instruction codes which makes C the first choice for the                    coders to    write device driver program. 

3. Major parts of operating system like LINUX and Windows are written in C. 

4. No language beats C when it comes to speed of excecution. 
    In the combat games like "fox one advanced" Where one has to shoot bullets       and missiles immediately along with navigating the plane at a high speed to        dodge the enemy missiles ,speed brings all the thrill! . U can't play the game         very slowly. The game has to react faster to the user. This is where C l l                 language scores over other languages. 

5. C language is preferred at times when one needs to closely interact with the
      hardware. 

Let's get started:

Like we communicate say in English here, communicating with a computer involves a language which it understand. 
Like in English we begin to learn by first learning alphabet, wods and then sentence and then paragraph,  in C we learn alphabet, digits, special symbols, variables and then instructions followed by programs . 


Character set in C

Character denotes any alphabet, digit or a special symbol that is used to represent information. 
Following special symbols are allowed in C.


Constants in C:

Constants in C are those entities which have fixed values.


We will discuss the further types in details later on
But discussing primary constants  is important.

Rules for construction of Integer constants:

1. An integer constant must have at least one digit. 
2. It should not have a decimal . 
3. It can either be positive or negative. 
4. No commas or blanks are allowed within an integer constant. 
5. If no sign is given before the integer constant, then it's assumed to be                     positive. 
Examples: 56,+54, -900 etc. 

Rules for construction of Real constants:

1. The real constants can be written in two forms-decimal and fraction
2. It could be either positive or negative. 
3. It must have at least one digit. 
4. No commas or blanks are allowed within a real constant. 
5. Default sign is positive. 

     Ex- 232.8,-43.8, etc

Rules for construction of character constants:

1. A character constant is a single digit, alphabet or any single special symbol         but it must be enclosed within single inverted commas. 
2. Both the inverted commas should point towards left. 
 
     Ex_  '1', '&', 'a' etc

Variables in C 

Variables in C hold different values of constants in them. 
For example an integer variable holds integer constant say 4.
When you declare a variable in C, a part of memory space is allotted to that variable and its value is then stored over there during program excecution. 

Rules:-
1. A variable name can be any combination of 27 alphabets, digits and                       characters.
2. The first character in the variable name must be an alphabet or                               underscore(_).
3. No commas or blanks are allowed within a variable name.
4. No special symbols other than underscore is allowed.
5. Variable name is case sensitive i. e. VARIABLE and variable are two different       variables in c.

Keywords in C :

Keywords are those words that are already been explained to the compiler. There are 32 keywords available in C.
Some are
Auto, break, while, double, int, float, if,switch, char, else, etc.

Conclusions:

1. You will be introduced to the origin of C programming language. 

2.  Like any language has several components and Subcomponents like                     alphabets, words, sentences and paragraphs
 
C language has alphabets, digits, special symbol, keywords, constants, and          variables as its subparts.
 

Did u guys find it helpful??
Should the tutorial be continued?
U are free to comment and share ur views and suggestions. 






Comments

  1. Very helpful, kind of boost reminder for me as a beginner......
    Thank you atharva

    ReplyDelete

Post a Comment

Popular posts from this blog

Python tutorial - #5 (Operators in Python)

Membership Operators This operator helps us to check an element is found in a sequence or not. It gives there result in Boolean value (True or False). ➥There are two types of Membership operator :- a) in b) not in ➢in membership operator This membership operator returns True if an element is found in a sequence and it returns  False When an element is not found in a sequence. Program - #1 ➢not in membership operator This membership operator returns True if an element is not found in a sequence and it returns False if an element is found in a sequence. Program = #2 Identity Operators This operator helps us to check whether two element are same or not. Actually, this operator compares the memory location of two object, if the memory locations are same then objects are also same otherwise the objects are not same.                                      ...

C tutorial #lecture 3

Here you will be introduced to the comments in C and some basic arithmetic operations on variables and you will learn various shorthand operators. Let's get started- Comments in C : Comments in C/C++ and in any other programming languages serve the purpose of improvement of readability of the code.  Comments are enclosed within /*-----------*/. This  symbol is used for multiline comments. For single line comments we use  // symbol  ( two backslashes) The rules of programming language aren't applicable within comments. The text doesn't appear in the output of the code but it appears in the source code. It just makes the program readable for the coder. This is a C code to illustrate comments.  Add caption       Output.  Nesting of comments : Comments written with /*----/*---*/--------*/  can't be nested and are invalid but a comment with  /*------//------*/ can be nested.  The f...