Translator (Wiki Translator ): converts any source code to designation or machine level language.
Compiler (Wiki Compiler):
- It compiles and checks the whole program for any error
- Execution is fast as compare to interpreter
- Debugging is slower as compare to interpreter
- It checks the program line by line and converts to machine level language if no error found
- Execution is slow
- Debugging is faster
Constant (Wiki Constant): It is a fixed value i.e. 0-9
- Integer constant : 0-9
- Float constant: with decimals
- Character constant: a, b, c
- String constant: "Name" with multiple characters
- It's written in lower care
- Each statement ends with semicolon (;)
- Each statement is written in the main under compound curly brackets i.e. main {program}
- It must start with alphabet i.e. a, b, c
- Special symbols are not allowed
- No blank space is allowed in between
- Only underscore (_) is allowed
- Numerical are not allowed
#include < stdio.h >
(stdio= Standard input output)
#include < conio.h >
(Conio= Console input output) used for displaying
printf ("Enter the first number");
scanf ("%d", & a);
printf ("%d", a)
Data Types (Wiki Data_Types): types of data used in programming
Name | Sign | Size |
char | %c | 1 Byte |
int | %d | 2 Byte |
float | %f | 4 Byte |
long int | %ld | 4 Byte |
double fload | %lf | 8 Byte |
Simple C program - Addition
/*-----------------------------start of program-------------------------
#include
#include
void main()
{
int a, b, c;
printf ("Enter the first number = ");
scanf ("%d", & a);
printf ("Enter the second number = ");
scanf ("%d", & b);
c=a+b;
printf ("Addition = %d", c);
getch();
}
----------------------------------end of the program--------------------*/
Now in compiler
Compile = Alt+F9
Run = Ctrl+F9
Output = Alt + F5
Comments: It is a statement which can we written anywhere in the program to understand the logical function for future use. Syntax for comment is /* Comment */ anythign in between /* and */ wont be analyzed by compiler.
No comments:
Post a Comment