Вы находитесь на странице: 1из 5

OPERATORS

1.Arithmetic operator
2.Relational operators
3.Logical operators
4.Bitwise
5.Assignment
6.Misc

1.-addition
-subtraction
-multiplication
-division
-increment++
-decrement--
-modular%

INCREMENT++
a++=it will assingn the value first thats why this is called postfix
++a=it will first increment the value and then assign is called prefix

Decrement--
same concept as increment only value will decrease

2.RELATIONAL
==(is equals to) it is type of comparison operator
!=(is not equals to)
<(is less than)
>
<=
>=

3.BITWISE
&(AND)
|(OR)
^(XOR)
-(one compliment)
<<(left shift)
>>(right shift)

3.ASSIGNMENT
=
+=
-=

4.MISC
turnery operator-used in reducing lines of code
_ _ _SWITCH STATEMENT
they are the control statement that allows to make a decision from the number
switch(expressions/conditions/values)
{
case constant1:
statements;
break;
case constant2:
statements;
break;
case constant3:
statements;
break;
default:
statements;
}
break is used to terminate the particular case
default understands for that if the user is giving wrong input then it must shown
on the screen
RULES FOR USING SWITCH CASES
1.case label must be unique
2.must have colon
3.must have constant expression
EXTRA POINTS
4.must be an integer
5.not be floating point
6.default can be placed anywhere
7. multiple cases cannot use same expressios

8.nesting of cases is allowed


9.variables are not allowed in switch case label

for loop,while loop and do while are over


JUMP STATEMENTS
1.break
2.continue-if we talk about while and do while and if we use continue over there
the control will go to the condition but if use for loop the control will go to the
updation part
3.go to-used for transfering control from one place to another.

formated and unformated input/output functions

_FORMAL ARGUMENYS and ACTUAL ARGUMENTS


Actual arguments- the arguments which are defined in function calling or passed
during function calling and pass some values also.value of actual arguments does
not change.
formal arguments- these functions are passed during function declaration.these
parameters recieve the value from the actual parameter when the function is called.
METHEODS FOR PASSING ARGUMENTS
_Call by value-the method of passing arguments by value is called call by value.
_Call by reference-this use the adress to refer to the actual location.

Local variables are defined inside the main function and these are accssesible
within the particular function.
global variables-vice versa of local variables these can be acsses anywhere
throughout the code or programme.

POINTERS
It is a variable that store adress of another variable.
example-
int*p;
intp;
p=&i;
during calling the function we use adresss.
pointers are use during funtion declaration.

RECURSION-a function itself is called recursion.

_STORAGE CLASSES-it shows varible storage location whether in memory or cpu


register.
auto-it is the default storage classes
and it storage is in memory.
Scope-LOcal to the block in which the variable is defined. storage in memory
Life-till the control remains within the block in which the variable is defined
storagenin memory.
Static variables-

***********************************************************************************
****************
ASCII-american standard code for information interchange.every character has
different ascii
FUNCTTIONS FROM STRING HANDLING LIBRARIES-
atof - it stands for ascii to float this converts a string that represents a
floating point number to adouble value.
#include<stdio.h>
#include<stdlib.h>
int main()
{
double d;
d=atof("88.0");
rpintf("%s%.3f/n%s
atoi- it converts a string of digit that represents an integer to an int valuethe
funtion returns the int value.
strtol-it converts to long a sequence of characters represnting an integer.
this function recieves three arguments string,pointer,integer.
strstr-it searches for the ffirst occurence of its second string arguments in its
first string argument.
if the first string is found in the first string argument ,a pointer to the
location of the astrinfg in the afirst string argument is returned.Otherwise
null pointer is returned.

in costant the vakue of the variable can be updated but value of a pointer cannot
be updated.
RElationship between pointers and arrays- while storing the adress of array in
apointer we do not use &.
Three ways to acsess elements of an array using pointers -
*(b);*(b+1)using array number as pointer;*(p+1)using pointer name;b[]using index
number or subscript.

#MEMORY ALLOCATIONS -
1.dynamic memory allocations header file will be stdlib.h
a. malloc - allocates requested size of bytes and returns a pointer.
b. calloc() - allocates space for an array elementts,initialisesto zero and then
returns a pointer to memory.
c.free() - deallocate the previously allocated space.
d. realloc() - cahnge the size of previously allocated space.

TWO ways of declaring a variable


1. struct car
{
int seats;
float price;
}my car; - this variable.
2. struct car my car
{
.................
................. same as above.

Two ways of initializing a variable


1. struct car mycar={"renault",50000.2"};
2. strct car mycar;
{
mycar.name="renault"
}

Two ways of accessing


1. DOT OPERATOR
car mycar;
printf("%d",mycar,seats);
2.ARROW OPERATOR
car *mycarptr = &mycar;
printf("%d",mycarptr->seats);

NESTED STRCTURES
1. SEPERATE
example-
struct date
{
int dd;
int mm;
int yy;
};
strct student
{
char name{20];
int rollno;
int marks;
struct date dob;
};
2.EMBEDDED
struct student

UNIONS
union and structures are almost same only two differences are there
1.keyword for union is union
2.storage

Вам также может понравиться