C Programming Basics: Mr. Ajay B. Kapase
C Programming Basics: Mr. Ajay B. Kapase
• Disadvantage:
• so hard for humans to read and understand
Evolution of Programming Language
• Assembly Language:
• each instruction is identified by a short abbreviation (rather
than a set of bits)
• We can use names and numbers
• Example: mov al, 061h
Information Data
Process
Environmental Setup
• Editor
• IDE
• Compiler (cc, gcc, clang, turboc)
• Extension
• .c
C Program Structure:
First C Program (Hello World)
header file section (Preprocessor Section)
Global declaration section
main()
{
declaration part;
executable part;
}
user-defined functions()
{
}
Compilation and Execution
#include …
……………
…………….. Compiler Executable Machine
………………..
………………
C program (.c)
C Program Structure:
First C Program (Hello World)
• Preprocessor Directives
• Functions
• Variables
• Statements & Expressions
• Comments
Tokens
• Smallest elements in C program which are meaningful to compiler.
Tokens
• Example
printf("Hello, World!");
Individual Tokens
1. printf
2. (
3. “Hello, World”
4. )
5. ;
Identifiers
• Name given and used to identify any function or variable
• Rules
• Must start with alphabet (A - Z, a - z) or Underscore (_)
• Can be followed by zero or more alphabets/digits/underscore
• Special characters (@/$/% etc.) not allowed
• Case sensitive
• Example:
Keywords
• words are reserved by C
• Used as standard words in C
• Should not be used as an identifier
• C contains 32 keywords
C Keywords
Data Types in C
• Defines the type of data to be stored
• Used with variables
• Divided into two major types
• Primary / Basic / Built In data Type
• Secondary / data types (created from primary)
Data Types in C
Thank You