C is a programming language was developed by Dennis Ritchie in 1972. The basic steps in learning c language are to understand the basics which are as follows:
BASICS:
Alphabets:
Alphabets in C programming include A,B,C,…,Z and a,b,c…,z.
Digits:
Digits in C programming include 0,1,2,3,…..,9
Symbols:
Symbols include all the special symbols that are on your keyboard i don’t have to type all those but still here they are:
~ Tilde
! Exclamation mark
# Number sign
$ Dollar sign
% Percent sign
^ Caret
& Ampersand
* Asterisk
( Left parenthesis
) Right parenthesis
_ Underscore
+ Plus sign
| Vertical bar
\ Backslash
` Apostrophe
– Minus sign
= Equal to sign
{ Left brace
} Right brace
[ Left bracket
] Right bracket
: Colon
” Quotation mark
; Semicolon
< Opening angle bracket > Closing angle bracket
? Question mark
, Comma
. Period
/ Slash
Constants:
These are the entities that do not change. there are different types of constants mentioned below:
1. Primary Constants
a. Integer constant
b. real constant
c. character constant
2. Secondary constants
In this post we will look at primary constants only and not make it more complicated here, secondary constants will be discussed later.
a.) Integer Constant;
* It should have at least 1 digit.
* It must not have a decimal point.
* It can be 0, positive, negative.
* No comma or blank are allowed within an integer constant.
* Range -2147483648 to +2147483647.
Example: 35, 78, 2378, 98
b.) Real Constants:
* They are also called floating point constants.
* Tow forms Fractional form and Exponential form( eg 0.0004678 can be written as 4.678e-4)
* It should have a decimal point.
* No comma or blank are allowed within an real constant.
Example: +34.67, 77.0, -329.78
c.) Character Constants:
* It is a single alphabet, a single digit or a single special symbol within single inverted commas (eg. ‘A’. ‘s’, ‘&’, ‘\’ )
Variables:
*It is an entity that changes.
*Variables are also called identifiers.
*An integer variable will only hold an integer constant..
*An real variable will only hold an real constant.
*An character variable will hold only an character constant.
Rules of constructing variable names:
* It is a combination of alphabets, digits, underscore(_)
*The first character of an variable must be alphabet or underscore.
*No commas or blanks are allowed withiin a variable name.
*No symbol other than underscore must be used in variable name.
Example: ni_pot, d_45 ( these are arbitrary variables with no meanings i have written them just for understanding).
*Always use meaning full variable names for the understanding of code interpreters for we humans.
*Now to differentiate between the variable names we have to declare the type of variable name at the beginning of the program.
Example:-
1.) Integer type variable is declared as “int” followed by variable name “num_1” ( int num_1).
2.) Real variable is declared as (float decimal_1).
3.) Character variable is declared as (char alphabt).
Keywords:
*Keyword is a word that carries special meaning which the compiler knows.
*There are 32 keywords in C.
*Remember never use keywords as a variable name.
The Keywords:
auto
break
case
char
const
continue
default
do
double
else
enum
extern
float
for
goto
if
int
long
register
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while
So we are done with this first post on basics I will go in detail on how to write a program in next post