C Progarmming 2 Marks
C Progarmming 2 Marks
1.what is c programming ?
C is a high-level language devoleped by dennis ritche in 1972 and general purpose
programming language that is ideal for firmware or portable application. it is proven,
flexible and powerful and may be used for a variety of different applications
2.features of c ?
1. Procedural Language
3. Modularity
4. Statically Type
5. General-Purpose Language
8. Middle-Level Language
9. Portability
3.importance of c ?
C programming 2 marks 1
problem or in other word to develop computer software.
C is feature rich powerful general purpose computer programming language.
4.what is c preprocessor ?
The C preprocessor is a micro processor that is used by compiler to transform your
code before compilation. It is called micro preprocessor because it allows us to add
macros.
All preprocessor directives starts with hash # symbol.
Let's see a list of preprocessor directives.
#include
#define
#undef
#ifdef
#ifndef
#if
#else
#elif
#endif
#error
#pragma
C programming 2 marks 2
int a = 10, b = 20, c;
c = (a < b) ? a : b;
printf("%d", c);
6.what is variables ?
Variables are containers for storing data values. In C, there are different types of
variables (defined with different keywords).
for example: int - stores integers (whole numbers), without decimals, such as 123 or
-123. float - stores floating point numbers, with decimals, such as 19.99 or -19.99.
7.string declaration in c ?
Declaring a String in C
A String in C is an array with character as a data type. C does not directly support string
as a data type, as seen in other programming languages like C++. Hence, character
arrays must be used to display a string in C. The general syntax of declaring a string in
C is as follows:
char variable[array_size];
8.data types ?
Data Types in C
A data type specifies the type of data that a variable can store such as integer, floating,
character, etc.
C programming 2 marks 3
9. C variable types ?
A variable is a name of the memory location. It is used to store data. Its value can be
changed, and it can be reused many times.
Types of Variables in C
There are many types of variables in c:
1. local variable
2. global variable
3. static variable
4. automatic variable
5. external variable
10.Storage class in c ?
C programming 2 marks 4
Storage Classes in C
Storage classes in C are used to determine the lifetime, visibility, memory location, and
initial value of a variable. There are four types of storage classes in C
Automatic
External
Static
Register
The continue statement passes control to the next iteration of the nearest
enclosing do , for , or while statement in which it appears, bypassing any
remaining statements in the do , for , or while statement body.
12.break statement ?
The break statement terminates the execution of the nearest enclosing do , for ,
switch , or while statement in which it appears.
Syntax:
While(test exp)
If(condition to break)
{
Break;
C programming 2 marks 5
13.recursion ?
Example
Main()
Main();
}
SYNTAX :
Int func()
C programming 2 marks 6
____
____
func();
14.what is function in c ?
15.define union in c ?
Union in C is a special data type available in C that allows storing different data
types in the same memory location.
Ex:
union car
{
char name[50];
int price;
};
16.array of pointers ?
Array of pointers
It is collection of addresses (or) collection of pointers
Declaration
Following is the declaration for array of pointers −
C programming 2 marks 7
For example,
int *p[5];
17.Types of files in c ?
Now, these data files are available in 2 distinct forms in the C language, namely:
Text Files.
Binary Files.
18.what is structure ?
A structure is a key word that create user defined data type in C/C++. A structure
creates a data type that can be used to group items of possibly different types into a
C programming 2 marks 8
single type.
EXAMPLE :
struct address
char name[50];
char street[100];
char city[50];
char state[20];
int pin;
};
C programming 2 marks 9