Monday, June 15, 2015

Introduction to C Language and Programming (Part II How To Use Variables)

How to use Variables

When you are programming, you want to show and store information, to do that, you have to have Variables, you can input data and store in variables. In programming, Few Variables types are available, there are some choices, it will depend on the data type which you are going to use and input to a variable.


Int     = Int can store integers (Numbers can be stored but it cannot store decimal numbers)
Char  = Char and store single character
Float  = float can store number with decimal

You tell the compiler that I’m going to use this variable as this type or that type or whatever, then only compile can identify about the variable.

Syntax of the declaring a variable:

<Variable type> <Name of the variable>;

Ex :
int myFrist;
int xy123;
char my1, my2, myName;

·        Here we have declared three variables by dividing commas, you can have multiple variables, but names must be different.
           char my1, my2, myName;

When we are naming the variables, you have to use camel case. It means when we are declaring a variable, we have to start the name of the variable by using Simple letter, but we can combine two words by using Capital letter as like below, you will see the camel :)


I hope you could have an idea about it, and also we must know, we cannot declare a variable starting from a number like below.

Int 123xy;
Char 124gh;

Those are wrong and cannot use as variables, after declare the variable, you have to close it by using semicolon, and then it will ready for using.

#include <stdio.h>
int main()
    int x;
   x = 10;
    printf( "The Number is %d: ", x);

    return 0;

When you are declaring a variable, you must know, you have to declare it first, or else it won’t be able to show the information that you have stored in the variable, and also there will be an error, because you cannot use a variable name without declare it first, try below example and you will understand.

Below program is not valid that is only an example:

#include <stdio.h>
int main()
    printf( "The Number is %d: ", x);
  int x = 10; 

    return 0;



  1. Replies
    1. IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes. IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble.Final Year Projects for CSE

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining .

      Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

      The Angular Training covers a wide range of topics including Angular Directives, Angular Services, and Angular programmability.Angular Training


  2. That's great about what you have expressed in this clear cut blog in sense of SEO , and yes this would make a wonderful blog. Here's a lot of technical and educational information plotted as in your writings, it was more understandable and easy to read.
    Sounds like something people would want to read this blog really!keep writing…

    seo training classes
    seo training course
    seo training institute in chennai
    seo training institutes
    seo courses in chennai
    seo institutes in chennai
    seo classes in chennai
    seo training center in chennai


  3. Thanks for your extraordinary blog. Your idea for this was so brilliant. This would provide people with an excellent tally resource from someone who has experienced such issues. You would be coming at the subject from a different angle and people would appreciate your honesty and frankness. Good luck for your next blog!
    Tally ERP 9 Training
    tally classes
    Tally Training institute in Chennai
    Tally course in Chennai

  4. Thanks for sharing this valuable information to our vision. You have posted a worthy blog keep sharing.
    Digital Marketing Course In Kolkata
    Web Design Course In Kolkata
    SEO Course In Kolkata


Facebook Fan Page

Popular Posts

Powered by Blogger.