Getting started with C

Getting started with C :

If we want to communicate with our computer it is very much needed that our computer understands what we want to say to it. Just like we speak english language to make others understand our motive is same…i.e to make our computer understand what we want to say to it.However, learning English language and learning C language are somewhat similar. The method of learning english includes learning alphabets used in the language then combines these alphabets to form words, which, in turn, are combined to form sentences and sentences are combined to form paragraphs.

Learning C is also similar and easier. If you are thinking to write your first program without knowing what are the essentials to compose the program is wrong.Hence writing a proper and user-friendly program needs the learning of similar alphabets, numbers, special symbols, constants, variables and keywords and finally all these essentials are combined to form a proper “Program”. This is illustrated in the image given below.

 

The C Character Set

A character denotes any alphabet, digit or special symbol used to represent information. fig 2 shows the valid alphabets, numbers and special symbols allowed in C.

The C character Set
The alphabets, Special symbols and digits when properly combined form constants,variables and keywords.

  • Constants: A constant is an entity that doesn’t change.
  • Variable: A variable is an entity that may change.
  • Special Symbols: These are some of the unique address or some unique id given to the data.

Types of C Constants :

C constants can be divided into two major categories:

  • Primary Constants
  • Secondary Constants
    Further these primary constants and Secondary Constants are devided into two
  • Primary constants: Integer Constants
    Real Constants
    Character Constants
  • Secondary Constants
    • Array
    • Pointer
    • Structure
    • Union
    • Enum etc.

There are certain rules which are to be followed for constructing these constants therefore,

 Rules for constructing Integer Constants:

  • An integer constant should have at least one digit.
  • It must not have a decimal point.
  • It can either be positive or negative.
  • If no sign precedes an integer constant, it is assumed to be positive.
  • No commas or blanks are allowed within an integer constant.
  • The allowable range for integer constants is -2147483648 to +2147483647.

 Rules for constructing Real Constants:

  • A real constant must have at least one digit.
  • It must have a decimal point.
  • It could be either positive or negative.
  • Default sign is positive
  • No commas or blanks are allowed within a real constant.
  • Range of real constants expressed in exponential form is -3.4e38 to 3.4e38.

Rules of Constructing Character Constants:

  • A character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas.Both the inverted commas should point to the left.
    For example, ‘A’ is a valid character constant.

Types of C Variables:

It is said earlier that , any thing which may vary during program execution is called a VARIABLE. Variable names are names given to locations in memory.These locations can contain integer,real or character constants.Now there are certab rules in constructing these variable names these rules are given below:

Rules for Constructing Variable names:

  • A variable name is any combination of 1 to 31 alphabets, digits or underscores. Some compilers allow variable names whose length could be upto 247 characters.Still, it would be safer to be with the rule of 31 characters.
  • The first character in the variable name must be an alphabet or underscore.
  • No commas or blanks are allowed within a variable name.
  • No special symbol other than an underscore can be used in a variable name.
    Ex: si_int
    m_hra
    pop_e_72.
    These rules remain the same for all the types of primary and secondary variables but then the question arises in our mind that how is C able to find out the diference between these variables?
    The answer is really simple “C Compiler”. It is able to find out the difference very easily.

C Keywords

Keywords are the words whose meanings has already been explained to the C compiler.
The keywords cannot be used as variable names because if we do so, we are trying to assign a new meaning to the keyword, which is not allowed by the computer.The keywords are also called by an another name “Reserved words”. There are in total 32 Keywords in C.


Before writing the first C program it is needed to know about some famous Compilers which are more easy to use in comparison to Turbo C or Turbo C++.
“Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE)for the C/C++ programming language. It uses Mingw port of GCC(GNU Compiler Collection) as it’s compiler. Dev-C++ can also be used in comination with Cygwin or any GCC based compiler.
In the coming article we will be going to write our first C program 🙂

 

Related Post

Strings String can be represented as a single-dimensional character type array. Strings in C are group of characters, digits, and symbols enclosed in quotatio...
First Java Program First Java Program NOTE: You need to have java installed on your system. Step 1: Open a text editor, like Notepad on windows and TextEdit on Mac. W...
How to install flutter | Flutter tutorial Flutter is the google’s mobile app SDK for develop the high-quality native app for iOS and android. We can develop the app by use of DART and javascri...
E-Mail Format Formal Email / Letter Format A formal email is in general sent to someone you don’t know well or to someone who’s in authority. Examples of someone w...
Java Operators Java Operators An operator is used to perform an operation over one or more operands. It is a character that represents an action, for example * is a...
Dart Libraries | Dart Tutorial Dart Libraries Dart has the following libraries, which are included in all Dart platforms: dart:core This library is automatically imported into ev...

Leave a Reply

Your email address will not be published. Required fields are marked *