C
PROGRAMMING BASICS
1.Introduction :
C is a powerful and
simplest programming language. It can be used to develop software like
operating systems, databases, compilers, and etc C programming is an excellent
language to learn to program for beginners.
Our C tutorials will guide you to learn C programming one step at a
time. This C tutorial series will
help you to get started in the C programming language. By learning C, you will
understand basic programming concepts.
1.2 About C:
C is a mid-level structured
oriented programming language, used in general-purpose programming, developed
by Dennis Ritchie at AT&T Bell Labs, the USA, between 1969 and 1973.
Ø
“? : ” is the only ternary operator in C language.
Ø
“sizeof” is the only operator which is also a keyword.
Ø In printf() and
scanf(), f stands for formatted not function.
Ø Compiler doesn't know
header file, preprocessor processes these and expands source code.
1.3 Advantages of C:
- Building block for many
other programming languages.
- Powerful and efficient language.
- Portable language.
- Built-in functions.
- Quality to extend itself.
- Structured programming
language.
- Middle-level language.
·
System Programming
1.4 Disadvantages of C:
- Run-time checking.
- Concept of namespace.
- Lack of Exception Handling.
- Constructor or destructor.
- Low level of abstraction.
In this tutorial, we will learn about keywords; reserved words in C
programming that are part of the syntax. Also, we will learn about identifiers
and how to name them.Let us get started…
2.Character
set:
The C character set consists
of upper and lowercase alphabets, digits, special characters and
white spaces. The alphabets and digits are altogether called as the
alphanumeric character. A variable is an entity that has a value
and is known to the program by name. we can also use special characters as
character set.
C accepts both lowercase and uppercase alphabets as
well as digits as variables and functions.
Example: A,B,C………Z
a,b,c………z
123456……” , ‘
+ = etc…
2.1 White space Characters:
Blank space,
newline, horizontal tab, carriage return and form feed.
3. C keywords :
Keywords are predefined, reserved words
in C language and each of which is associated with specific
features. These words help us to use the functionality of C language.
They have special meaning to the compilers.
3.1 Keywords in C Programming |
|||
4.Identifier in C Language
C
identifiers represent the name in the C program, for example, variables,
functions, arrays, structures, unions, labels, etc. An identifier can be
composed of letters such as uppercase, lowercase letters, underscore, digits,
but the starting letter should be either an alphabet or an underscore.
Example:
int amount; double totalbalance; In the above example, amount and
totalbalance are identifiers and int, and double are keywords.
5. Rules for naming a variable
- All variable names must
begin with a letter of the alphabet or an. Underscore ( _ ). ...
- After the first initial
letter, variable names can also contain letters and
numbers. ...
- Uppercase characters are
distinct from lowercase characters. ...
- You
cannot use a C++ keyword (reserved word) as a variable name.
- We can choose any name as an identifier if we follow the above rule, however, give meaningful names to identifiers that make sense.