C Character Set

C Character Set



  1. Letter (A-Z, a-z)
  2. Digits (0-9)
  3. White Spaces (Horizontal tab,new line)
  4. Special Characters (:, ;, "",'',!, .,?)


Identifier

An identifier is a string of alphanumeric characters that begins with an alphabetic character or an underscore character that are used to represent various programming elements such as variables, functions, arrays, structures, unions and so on. Actually, an identifier is a user-defined word.


Keywords 


Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier. For example: int money; Here, int is a keyword that indicates 'money' is a variable of type integer.


Constants

In computer programming, a constant is a value that cannot be altered by the program during normal execution, i.e., the value is constant. This is contrasted with a variable, which is an identifier with a value that can be changed during normal execution, i.e., the value is variable.

Data Types

In computer science and computer programming, a data type or simply type is a classification of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support various types ofdata, for example: real, integer or Boolean.

There are five basic data types associated with variables:
  • int - integer: a whole number.
  • float - floating point value: ie a number with a fractional part.
  • double - a double-precision floating point value.
  • char - a single character.
  • void - valueless special purpose type which we will examine closely in later sections.



Functions

printf();
  • printf("Abc")
  • printf("%d",x);-------------------->to print value of x

scanf();
  • scanf("%d",&x); int x;

Declaring variables:

General syntax;

datatype variable;
For eg: 
  • int x ;
  • int x, y, z;
  • float x;
  • char;
  • char [10] x;
For Input

1. Assigning values to variables:
          { int x=2, y=3, z;
              z=x+y
             printf("%d",z);
                 }


2. Reading through keyboard during runtime

   { int x, y, z;
        printf("Enter x and y");
        scanf("%d%d",&x,&y);
        s = x+y;
        printf("%d", s);
              }

Comments

/*_____________*/ , \n, \t


Click here for Differents Programs


No comments