Professional Documents
Culture Documents
•C program structure
•Standard library and function
•Types of errors
• Example 1:-
The output statement,
printf(“%c”,’T’);
will print the letter T on the screen.
• Example 2:-
char S=‘a’;
printf(“%c”,S);
will print the letter S on the screen.
• String Constant:
A string literal or string constant is a
sequence of any number of characters
surrounded by double quotation marks.
• Following are examples of String Constants.
“This is a String Constant”
“ 125”
“Is this John’s car?”
• Example 2:-
Using Characters:
char a;
scanf(“%c”,&a);
printf(“The character is …..%c”,a);
Input of String variables:
char name[10];
scanf(“%s”, name); Gets the characters
until the occurrence of
the white space/blank
OUTPUT:
Enter the radius value: 2
main ()
{
float inches,cm;
/* variable declaration */
printf(”Enter a length in inches:
”);
/* ... rest of statements follow ...
*/
}
Syntax Errors
Logical Errors
Runtime Errors