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

Custom View by use of xib in swift Custom View by use of xib in swift We can create the custom and common view by the use xib in swift 3.1 and xcode 8.3.2 . Custom views are common and...
Switch Case Statement Switch Case Statement The switch statement is a multi-way branch statement. It provides an easy way to dispatch execution to different parts of c...
New Tools for 64-bit Support in Xcode 9.3   New Tools for 64-bit Support in Xcode 9.3 The last macOS release to support 32-bit apps without compromise is macOS High Sierra. Make sure fu...
Compile C/C++ program (Dev-C/C++) what is Dev-C/C++? Dev-C/C++, developed by Bloodshed Software, is a fully featured graphical IDE(Integrated Development Environment),which ...
Array An array is a collection of similar kind of data elements stored in adjacent memory locations and are referred to by a single array-name. The first el...
Dart Data type | Dart Tutorial Dart Data type Variables can store data of different types, and different data types can do different things. Dart supports the following data typ...

Leave a Reply

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

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.