1. Errors are
mistakes in program, which are traced by the compiler.
Que
13.Explain errors of C programs in detail.
Ans.
Errors are mistakes in program, which are traced by the compiler while
compilation. A program can only execute when all the errors are corrected.
Types
of errors:
1) Logical errors – occur when the
result we get is not correct because of the incorrect code logic.
2) Syntax : occur when the grammar of
the C language is not used properly.
For
ex
1. Typing Printf or print instead
of printf.
2. Forgetting a semicolon (;) at the
end of an executable C statement.
3. Mismatch of parenthesis.
Explain some common Errors:
1. Typing
Printf or print instead of printf.
2. Forgetting
a semicolon (;) at the end of an executable C statement.
3. Mismatch of
paranthesis.
Que 15. Explain Format
Specifiers.
Ans. Format Specifiers
are % sing followed by a letter which actually prints the value of the
variable. Following are the list of format specifiers used in C to print the
value of variables of different types.
%c
|
Character format
Specifiers
|
%d
|
Signed Integer
format Specifiers
|
%f
|
Floating point
format Specifiers
|
%lf
|
Floating point
format Specifiers
|
%s
|
String format
Specifiers
|
%u
|
Unsigned Integer
format Specifiers
|
%n
|
Prints nothing
|
%%
|
Prints % character
|
No comments:
Post a Comment