Академический Документы
Профессиональный Документы
Культура Документы
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
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.
***********************************************************************************
****************
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.
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