Programming Language C
after the previous issue
Assemblers: An assembler is a program that translates an
assembly language program into machine language.
Compilers: A compiler is a language processor that
translates an entire high-level language program into a machine
language version of these programs in a single process. If no
programming errors exist in the source code, the program becomes
operative.
Interpreters: An interpreter is a language processor that
translates and executes high-level language. Instructions on
instruction statement at a time and if errors are detected in the
source code, the in interpreter displays immediate feedback on the
screen.
Variable:
The most fundamental of all concepts in C is the variable. A
variable is a like a small box. You can store things in the box for
later use particularly numbers. The concept of a variable is use
from mathematics. A statement such as X=1.
Integer (Int.): Integers are also known as counting numbers
or whole numbers. Integers are whole numbers with range of values
supported by a particular machine.
All C
compilers support four fundamental data types namely integer (int),
character (char), floating point (float) and double-precision
floating point (double). Many of then also offer extended data types
such as long int. and long double.
Float: Floating-point numbers are defining in C by the key
word float.
Character: A single character can be defined a character
(char) type data.
About using some C statement:
A program
can contain one or many functions but must always have a function
called “main”. The “main” functions is the starting point of all C
programs and the compiler will not compile the code unless it finds
a function called “main” within the program.
The plain
brackets that follow the function name can optionally contain values
to be use by that function. These take the form of a comma-separated
list and are know as function “arguments”.
The curly
brackets (braces) contain the statements to be executing whenever
the functions to be execute. A semi-colon must terminate each
statement in the same way that a semi-colon must terminate English
language sentences, in the same way that English language sentences
must be terminate by a full stop.
Program code:
#include<stdio.h>
#include
<conio.h>
Void main
( )
{
printf {
“Hello Nari Jibon\n”};
}
The
program code begins with an instruction to the compiler to include
information from the standard input or output library, stdio and the
“.h” files are by convention “header files”. The # character starts
the line to denote a preprocessor instruction. Notice that the name
of the library must be enclosing by <and> angled brackets.
In the
function declaration, the data type is specifying as int., meaning
integer. This means that after executing its statements this
function must return an integer value to the operating system.
To
write a C Program adds any two digits:
#include<stdio.h>
#include<conio.h>
void main
()
{
int
a,b,sum;
clrscr
();
printf
(“enter the first number:\n”);
scanf
(“%d”, &a);
printf
(“enter the second number:\n”);
scanf
(“%d”, &b);
sum = a+b;
printf
(“result is: %d”, sum);
getch ();
}
One of
these is a function named scanf() that is used to write the input of
a program and another one is printf() that is used to write the
output from a program. The “&” character, in this case, is the
“addressof” operator that directs the input to be stored in the
variable name that it precedes and “%d” represents the integer
value. “\n” prints a “new line” character, which brings the cursor
onto the next line.
continuing
Taslima Akter |