Sie sind auf Seite 1von 14

Table of Contents

 Variables And Data Types


 Operators
 Control Flow
 Arrays
 Functions
 Strings
 Pointers
 Structures
 File Input and Output
 Dynamic Memeory Allocation
 Variable:

A variable is nothing but a name given to a storage area that our programs can
manipulate. Each variable in C has a specific type, which determines the size and
layout of the variable's memory; the range of values that can be stored within that
memory; and the set of operations that can be applied to the variable.

The name of a variable can be composed of letters, digits, and the underscore
character. It must begin with either a letter or an underscore. Upper and
lowercase letters are distinct because C is case-sensitive.

 Data Types:

Data types in c refer to an extensive system used for declaring variables or


functions of different types. The type of a variable determines how much space it
occupies in storage and how the bit pattern stored is interpreted.
 Operators:

An operator is a symbol that tells the compiler to perform specific mathematical or logical
functions. C language is rich in built-in operators and provides the following types of
operators −

 Arithmetic Operators
 Relational Operators
 Logical Operators
 Bitwise Operators
 Assignment Operators
 Misc Operators
 Arrays

Arrays a kind of data structure that can store a fixed-size sequential collection
of elements of the same type. An array is used to store a collection of data,
but it is often more useful to think of an array as a collection of variables of the
same type.

C supports multidimensional arrays. The simplest form of the multidimensional


array is the two-dimensional array.
Example:Matrices
 Functions:

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.

 Library Functions
 User Defined Function

 Function Name
 Parameter list
 Function Body
 Strings:

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.

String Functions:

 Strcat
 Strlen
 Strcmp
 Strrev
 Strcpy
 Pointers:

A Pointer in C language is a variable which holds the address of another


variable of same data type.
Pointers are used to access memory and manipulate the address.
 Structures:

Structure is a user-defined datatype in C language which allows us to combine data


of different types together. Structure helps to construct a complex data type which is
more meaningful. It is somewhat similar to an Array, but an array holds data of similar
type only. But structure on the other hand, can store data of any type, which is
practical more useful.

 Struct
 Unions

Unions are conceptually similar to structures. The syntax to declare/define a union is also
similar to that of a structure. The only differences is in terms of storage. In structure each
member has its own storage location, whereas all members of union uses a single shared
memory location which is equal to the size of its largest data member.
 Typedef:

Typedef is a keyword used in c language to assign alternative names


to the Existing datatypes.It is mostly used with the userdefined
datatypes. when names of the datatypes become slightly
complicated to use in programs.
 File Input and Output:

Input means to provide the program with some data to be used in the
program and Output means to display data on screen or write the data to a
printer or a file.

 Scanf
 Printf
 Getchar
 Putchar
 Get’s
 Put’s
 Dynamic Memory Allocation:

 Malloc:

allocates requested size of bytes and returns a void pointer


pointing to the first byte of the allocated space

 Calloc:

allocates space for an array of elements, initialize them to zero


and then returns a void pointer to the memory

 Realloc

modify the size of previously allocated space

 Free:

releases previously allocated memory


ThanQ

Das könnte Ihnen auch gefallen