Are you searching for C Language Training in Ambala? Noe tour search ends here.... Batra Computer Centre provides you the best training in C Language in Ambala. Btra Computer Centre offers you many other courses like Basic Computer Course, C& C++, SEO, Web Designing , Web Development and many more...
2. C is a High level structured oriented programming
language.
Used in general purpose programming
C was developed by DENNIS RITCHIE at AT& T Bell
Laboratories in USA between 1969-1973.
3. C is a general-purpose programming language.
C is a programming language which born at “AT & T’s Bell
Laboratory” of USA in 1972.
C was written by Dennis Ritchie, that’s why he is also called
as father of c programming language.
C language was created for a specific purpose i.e., designing
the UNIX operating system (which is currently base of
many UNIX based OS From the beginning, C was intended
to be useful to allow busy programmers to get things
done because C is such a powerful, dominant and supple
language
Its use quickly spread beyond Bell Labs in the late 70’s
because of its long list of strong features.
4. Simple
Portability
Powerful
Platform dependent
Structure oriented
Case sensitive
Compiler based
Modularity
Middle level language
Syntax based language
Use of Pointers
5.
6.
7.
8. In C, we have 32 keywords, which have their predefined
meaning and cannot be used as a variable name. These
words are also known as “reserved words”.
9.
10. Header files contain definitions of functions and
variables which can be incorporated into any C program
by using the pre-processor #include statement. Standard
header files are provided with each compiler, and cover a
range of areas, string handling, mathematical, data
conversion, printing and reading of variables.
11. <assert.h> Diagnostics Functions
<ctype.h> Character Handling Functions
<locale.h> Localization Functions
<math.h> Mathematics Functions
<setjmp.h> Nonlocal Jump Functions
<signal.h> Signal Handling Functions
<stdarg.h> Variable Argument List Functions
<stdio.h> Input/Output Functions
<stdlib.h> General Utility Functions
<string.h> String Functions
12. A data type in a programming language is a set
of data with values having predefined characteristics.
The language usually specifies the range of values for a
given data type, how the values are processed by the
computer, and how they are stored.
13. Variables are used to store information to be referenced
and manipulated in a computer program. They also
provide a way of labeling data with a descriptive name,
so our programs can be understood more clearly by the
reader and ourselves. It is helpful to think of variables as
containers that hold information. Their sole purpose is
to label and store data in memory. This data can then be
used throughout your program
14. Characters Allowed :
Underscore(_)
Capital Letters ( A – Z )
Small Letters ( a – z )
Digits ( 0 – 9 )
Blanks & Commas are not allowed
No Special Symbols other than underscore(_) are
allowed
First Character should be alphabet or Underscore
Variable name Should not be Reserved Word
15.
16. A storage class defines the scope (visibility) and life-time
of variables and/or functions within a C Program. They
precede the type that they modify. We have four
different storage classes in a C program −
auto
register
static
extern
17. C Constants are also like normal variables. But, only
difference is, their values can not be modified by the
program once they are defined.
Constants refer to fixed values. They are also called as
literals
Constants may be belonging to any of the data type.
Syntax:
const data_type variable_name; (or) const data_type
*variable_name;
18. An operator is a symbol which operates on a value or a
variable. For example: + is an operator to perform addition.
There are some different type of operators:
19.
20. A control statement is a statement that determines
whether other statements will be executed.
21. Conditional statements are used to execute a statement
or a group of statement based on certain conditions .
Following are the conditional statements:
if
if else
else if
switch
goto
22. if(condition)
{
Valid C Statements;
}
Syntax for if statement in C :
If the condition is true the statements inside the
parenthesis { }, will be executed, else the control will
be transferred to the next statement after if.
23. if(condition)
{
Valid C Statements;
}
else
{
Valid C Statements;
}
Syntax for if :
In if else if the condition is true the statements
between if and else is executed. If it is false
the statement after else is executed.
24. switch(variable)
{
case 1:
Valid C Statements;
break;
-
-
case n:
Valid C Statements;
break;
default:
Valid C Statements;
break;
}
Syntax :
Switch statements can
also be called matching
case statements. If
matches the value in
variable
(switch(variable)) with
any of the case inside,
the statements under
the case that matches
will be executed. If
none of the case is
matched the statement
under default will be
executed.
25. Basic syntax to use ‘for’ loop is:
for (variable initialization; condition to control loop;
iteration of variable) { statement 1; statement 2; .. .. }
26. It is another loop like ‘for’ loop in C. But do-while loop
allows execution of statements inside block of loop for
one time for sure even if condition in loop fails.
Basic syntax to use ‘do-while’ loop is:
variable initialization; do { statement 1; statement 2; .. ..
iteration of variable; } while (condition to control loop)
27. It is another loop like ‘do-while’ loop in C. The ‘while’
loop allows execution of statements inside block of loop
only if condition in loop succeeds.
Basic syntax to use ‘while’ loop is:
variable initialization; while (condition to control loop) {
statement 1; statement 2; .. .. iteration of variable; }
28. A function is a group of statements that together
perform a task. Every C program has at least one
function, which is main(), and all the most trivial
programs can define additional functions.
A function declaration tells the compiler about a
function's name, return type, and parameters. A
function definition provides the actual body of the
function.
29. The general form of a function definition in C
programming language is as follows −
Syntax:
return_type function_name( parameter list ) { body of
the function }
30. A function declaration tells the compiler about a
function name and how to call the function. The
actual body of the function can be defined separately.
Syntax:
int max(int num1, int num2);
31. An array is a collection of data items, all of the same
type, accessed using a common name.
A one-dimensional array is like a list; A two
dimensional array is like a table; The C language
places no limits on the number of dimensions in an
array, though specific implementations may.
Some texts refer to one-dimensional arrays as vectors,
two-dimensional arrays as matrices, and use the
general term arrays when the number of dimensions
is unspecified or unimportant.
32. . Array variables are declared identically to variables of their data type,
except that the variable name is followed by one pair of square [ ]
brackets for each dimension of the array.
Uninitialized arrays must have the dimensions of their rows, columns,
etc. listed within the square brackets.
Dimensions used when declaring arrays in C must be positive integral
constants or constant expressions.
In C99, dimensions must still be positive integers, but variables can be
used, so long as the variable has a positive value at the time the array is
declared. ( Space is allocated only once, at the time the array is declared.
The array does NOT change sizes later if the variable used to declare it
changes. )
Examples:
int i, j, intArray[ 10 ], number; float floatArray[ 1000 ]; int tableArray[ 3
][ 5 ];
33. A pointer is a variable whose value is the address of
another variable, i.e., direct address of the memory
location. Like any variable or constant, you must declare a
pointer before using it to store any variable address. The
general form of a pointer variable declaration is −
Syntax:
type *var-name;
Here, type is the pointer's base type; it must be a valid C
data type and var-name is the name of the pointer variable.
The asterisk * used to declare a pointer is the same asterisk
used for multiplication.
34. Strings are actually one-dimensional array of characters
terminated by a null character '0'. Thus a null-
terminated string contains the characters that comprise
the string followed by a null.
35. Syntax:
char greeting[6] = {'H', 'e', 'l', 'l', 'o', '0'};
If you follow the rule of array initialization then you can
write the above statement as follows −
36. Strings are actually one-dimensional array of characters
terminated by a null character '0'. Thus a null-
terminated string contains the characters that comprise
the string followed by a null.
37. There are numerous functions defined
in "string.h" header file. Few commonly used string
handling functions are discussed below:
Function Work of Function
strlen() Calculates the length of string
strcpy() Copies a string to another string
strcat() Concatenates(joins) two strings
strcmp() Compares two string
strlwr() Converts string to lowercase
strupr() Converts string to uppercase
38. Arrays allow to define type of variables that can hold
several data items of the same kind.
Similarly structure is another user defined data type
available in C that allows to combine data items of
different kinds .Structures are used to represent a record
39. To define a structure, you must use
the struct statement. The struct statement defines a
new data type, with more than one member. The format
of the struct statement is as follows −
Syntax:
struct [structure tag] { member definition; member
definition; ... member definition; } [one or more
structure variables];
40. You can define pointers to structures in the same way as you
define pointer to any other variable −
Syntax:
struct Books *struct_pointer;
Now, you can store the address of a structure variable in the
above defined pointer variable. To find the address of a
structure variable, place the '&'; operator before the
structure's name as follows −
Syntax:
struct_pointer = &Book1;
41. A union is a special data type available in C that allows
to store different data types in the same memory
location. You can define a union with many members,
but only one member can contain a value at any given
time. Unions provide an efficient way of using the same
memory location for multiple-purpose.
42. To define a union, you must use the union statement in
the same way as you did while defining a structure. The
union statement defines a new data type with more than
one member for your program. The format of the union
statement is as follows −
Syntax:
union [union tag] { member definition; member
definition; ... member definition; } [one or more union
variables];
43. File Handling concept in C language is used for store a
data permanently in computer. Using this concept we
can store our data in Secondary memory (Hard disk). All
files related function are available in stdio.h header file.
44. For achieving file handling in C we need follow following
steps:
Naming a file
Opening a file
Reading data from file
Writing data into file
Closing a file
45. S.No Function Operation
1 fopen() To create a file
2 fclose() To close an existing file
3 getc() Read a character from a file
4 putc() Write a character in file
5 fprintf() To write set of data in file
6 fscanf() To read set of data from file.
5 getw() To read an integer from a file
6 putw() To write an integer in file
46. Data structure of file is defined as FILE in the standard
I/O function. So all files should be declared as type
FILE.
Before opening any file we need to specify for which
purpose we open file, for example file open for write or
read purpose.
Syntax:
FILE *fp; pf=fopen("filename", "mode");
47. S.No Mode Meaning Purpose
1 r Reading Open the file for reading only.
2 w Writing Open the file for writing only.
3 a Appending Open the file for appending (or
adding) data to it.
4 r+ Reading + Writing New data is written at the
beginning override existing
data.
5 w+ Writing + Reading Override existing data.
6 a+ Reading + Appending To new data is appended at the
end of file.
48. S.No Function Operation Syntax
1 getc() Read a character
from a file
getc( fp)
2 putc() Write a character in
file
putc(c, fp)
3 fprintf() To write set of data
in file
fprintf(fp, "control
string", list)
4 fscanf() To read set of data
from file.
fscanf(fp, "control
string", list)
5 getw() To read an integer
from a file.
getw(fp)
6 putw() To write an integer
in file.
putw(integer, fp)