Chapter No: 2 C Part - II
Introductions to C Language
Question No Question
1 Explain structure of C Program
2 What is Token?
3 Define Term Identifier, Keywords & Constants
Mentioned
4 What is Tri-Graph character?
Topics5 in Explain different data types available in C.
6
Document Define the term precedence and associativity.
7 Explain different operators available in C.
8 Explain implicit type casting & explicit type casting.
9 What is the use of header file?
10 Explain printf() and scanf() function with example.
11 Explain getch(), getche() and getchar() with example.
12 Explain putchar() with example.
1.
Q Explain Structure of C Program.
Answer:
Basic structure of C program:
Documentation Section
Link Section
Definition Section
Global declaration Section
main()
{
Declaration Part;
Executable Part;
}
Subprogram Section
User defined Function
Various sections of C program are as under:-
, Documentation Section It contains set of comment lines giving
(Optional) the details of the program like name of
program, author name and date of
Link Section It contains the list of standard header files
which are needed to execute the program.
For example stdio.h and conio.h
Definition section It defines pre-processor directives
(Optional)
Global section Variables that are common for more than
(Optional) one function are declared in global
main() It is a function that must be present in
every C program. It is the first function
that is called up when the program is
executed. It is used with two curly
brackets to group the statements together
Subprograms The sub program section contains user
(Optional) defined functions.
Example:-
// a program to print hello world (Documentation Section)
#include <stdio.h>
Link Section
#include<conio.h>
void main()
{
Printf(“Hello
main Section
World”);
getch();
}
, 2.
Q What is Token?
Answer:
• The smallest individual unit of C program is known as C tokens.
• The C compiler breaks down the instructions into various components.
• A token is a source program text which compiler does not break into further
elements.
• This basic elements recognized by the compilers are known as “tokens”.
• These elements are further classified into keywords, identifiers, Constants,
Operators, Strings and Special Symbols.
Identifier
For Ex.(Variable name,
function name etc.)
Keywords
For Ex.(int, float,
while, etc.)
Constants
For Ex.(79, 3.14 etc.)
Toke
n
Operators
For Ex.(+, -, *, etc.)
String
For Ex.(“xyz”,
”VVP”, etc. )
Special Symbol
For Ex.(#, $, \, etc.)
Introductions to C Language
Question No Question
1 Explain structure of C Program
2 What is Token?
3 Define Term Identifier, Keywords & Constants
Mentioned
4 What is Tri-Graph character?
Topics5 in Explain different data types available in C.
6
Document Define the term precedence and associativity.
7 Explain different operators available in C.
8 Explain implicit type casting & explicit type casting.
9 What is the use of header file?
10 Explain printf() and scanf() function with example.
11 Explain getch(), getche() and getchar() with example.
12 Explain putchar() with example.
1.
Q Explain Structure of C Program.
Answer:
Basic structure of C program:
Documentation Section
Link Section
Definition Section
Global declaration Section
main()
{
Declaration Part;
Executable Part;
}
Subprogram Section
User defined Function
Various sections of C program are as under:-
, Documentation Section It contains set of comment lines giving
(Optional) the details of the program like name of
program, author name and date of
Link Section It contains the list of standard header files
which are needed to execute the program.
For example stdio.h and conio.h
Definition section It defines pre-processor directives
(Optional)
Global section Variables that are common for more than
(Optional) one function are declared in global
main() It is a function that must be present in
every C program. It is the first function
that is called up when the program is
executed. It is used with two curly
brackets to group the statements together
Subprograms The sub program section contains user
(Optional) defined functions.
Example:-
// a program to print hello world (Documentation Section)
#include <stdio.h>
Link Section
#include<conio.h>
void main()
{
Printf(“Hello
main Section
World”);
getch();
}
, 2.
Q What is Token?
Answer:
• The smallest individual unit of C program is known as C tokens.
• The C compiler breaks down the instructions into various components.
• A token is a source program text which compiler does not break into further
elements.
• This basic elements recognized by the compilers are known as “tokens”.
• These elements are further classified into keywords, identifiers, Constants,
Operators, Strings and Special Symbols.
Identifier
For Ex.(Variable name,
function name etc.)
Keywords
For Ex.(int, float,
while, etc.)
Constants
For Ex.(79, 3.14 etc.)
Toke
n
Operators
For Ex.(+, -, *, etc.)
String
For Ex.(“xyz”,
”VVP”, etc. )
Special Symbol
For Ex.(#, $, \, etc.)