|
.
What
is C : - C Programming
Tutorial
The C programming
language is a widely used programming language for
creating computer programs. This powerful computer
programming language was developed in 1972 by Dennis
Ritchie at the Bell Telephone Laboratories. C
programming is used basically for System
programming. C
language is a middle level language. It is a
structured language. C language is a case sensitive
language. All syntax written in c language is in
lower case. C is the basis for C++. The statements,
commands used in C are also available in C++. Thus
learning C is a first step towards learning C++ which
is quite similar to c with some additional features.
This is simple Hello
World Program in C language:
#include
<stdio.h>
int main(void)
{
printf("hello, world\n");
return 0;
} There is
always a main() function in a c program.
A function has the form:
type name_function
(parameters)
{
local variables
C Statements
}
The printf function
is a function used to print the output to the
screen.
Note:#include<stdio.h>
=this is a header file used in c. This line
starts with a #, and is called a preprocessor
directive. The preprocessor directive reads our
program before it is complied and only executes
those lines beginning with a # symbol. The word
inside the angular brackets <> is a header file
name, which is required to do the work of Input /
Output. The contents of stdio.h header file are
included at the place where the #include statement
appears. The statement inside the function are
terminated with a semicolon , the preprocessor
directives should not end with a semicolon because
preprocessors are messages to the compiler.
Another Simple C
program:
main() {
int no;
puts("Please enter a no.: ");
scanf("%d", &no);
printf("The number is %d",no);
}
*****************************************************************************************************************
scanf function : This
lets us input from the keyboard and for that input
is to be taken by the program and processed.
printf function: It is
a function used to print the output to the screen.
%d=integer %f=float
%c=char %s =s tring %e=inputs number in scientific
notation
Following is a
list of keywords
in C
|
auto |
break |
case |
char |
const |
|
continue |
default |
do |
double |
else |
|
enum |
extern |
float |
for |
goto |
|
if |
int |
long |
register |
return |
|
short |
signed |
sizeof |
static |
struct |
|
switch |
typedef |
union |
unsigned |
virtual |
|
void |
volatile |
while |
Dynamic
Memory
Allocation in C
C
provides us a
powerful way to
manage memory
allocation. See
the below
program to see
how memory is
managed in C
language. With
dynamic memory
allocation we
can allocate and
free memory as
per our
requirements.

COPYRIGHT 2009 ALL RIGHTS RESERVED
FREECPROGRAMS.COM |