Saturday, February 18, 2012

First tutorial- about Variable declaration and identifiers

 Identifiers are the names that are given to various program elements such as variables, symbolic constants and functions.Variable or function identifier that is called a symbolic constant name.
Identifier can be freely named, the following restrictions.
  • Alphanumeric characters ( a ~ z , A~Z , 0~9 ) and half underscore ( _ ) can only be used.
  • The first character of the first contain letters ( a ~ z , A~Z ) or half underscore ( _ ) can only be used.
  • Case is distinguishable. That is, word and WORD is recognized as a separate identifier.
  • Reserved words are not allowed. However, part of an identifier reserved words can be included.
  • Here are the rules you need to know:
    1.       Identifier name must be a sequence of letter and digits, and must begin with a letter.
    2.       The underscore character (‘_’) is considered as letter.
    3.       Names shouldn't be a keyword (such as int , float, if ,break, for etc)
    4.       Both upper-case letter and lower-case letter characters are allowed. However, they're not interchangeable.
    5.       No identifier may be keyword.
    6.       No special characters, such as semicolon,period,blank space, slash or comma are permitted
    Examples of legal and illegal identifiers follow, first some legal identifiers:
    float _number;
    float a;
    int this_is_a_very_detailed_name_for_an_identifier;
    The following are illegal (it's your job to recognize why):
    float :e;
    float for;
    float 9PI;
    float .3.14;
    float 7g;
    Example:
    Click on following gif image:

Introduction to C-Language

Before we can begin to write serious programs in C, it would be interesting to find out what really is C, how it came into existence and how does it compare with other computer languages.
C is a programming language developed at AT & T’s Bell Laboratories of USA in 1972. It was designed and written by a man named Dennis Ritchie

Possibly why C seems so popular is because it is reliable, simple and easy to use. Moreover, in an industry where newer languages, tools and technologies emerge and vanish day in and day out, a language that has survived for more than 3 decades has to be really good.
First C Program:
#include<Stdio.h>
main()
{
printf(“Welcome to C Programm”);
}

main( ) is a collective name given to a set of statements. Technically speaking main( ) is a function. Every function has a pair of parentheses ( ) associated with it. One such function is printf( ). We have used it display on the screen “hello word”.
Steps for compilation and execution of C-Program:
Assuming that you are using a Turbo C or Turbo C++ compiler here are the steps that you need to follow to compile and execute your first C program…
(a) Start the compiler at C> prompt. The compiler (TC.EXE is usually present in C:\TC\BIN directory).
(b) Select New from the File menu.
(c) Type the program.
(d) Save the program using F2 under a proper name (say Program1.c).
(e) Use Ctrl + F9 to compile and execute the program.
(f) Use Alt + F5 to view the output.
Note that on compiling the program its machine language equivalent is stored as an EXE file (Program1.EXE) on the disk. This file is called an executable file.



"ITS JUST START"