C Notes For CP

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

C language designed by DENISE RICHHIE (AT AND T’s Bell Laboratories)

C constants- primary constants- integers, real and character

Secondary constants- array, pointer, structure, union, ennum

y 1 PRIMARY CONSTANTS

# Integer constants – contains at least one digit

No decimal point

Can have both positive and negative values

No commas or blanks are allowed

Allowed range of values- - 2147483648 to +2147483647 ( visual studio or gcc)

-32768 to 32767 for TURBO C AND TURBO C++

# Real Constants ( FLOATING POINT CONSTANTS )- must at least contain one digit

Must have a decimal point

Could be positive or negative

No commas or blanks are allowed

*Can write in exponential form also – 0.000324= 324e-4

part before e is called mantissa ; part after e is called exponent

both mantissa and exponent can take positive and negative values. Default sign in both is positive

range- -3.4e38 to 3.4e38

# CHARACTER CONSTANTS – single digit, single alphabet or single character symbol enclosed with single
inverted commas pointed to the left.

Eg- ‘a ‘
CONSTRUCTING VARIABLE CONSTANTS

1. Any combination of 1 to 31 alphabets


2. First character should be an alphabet or an underscore
3. No commas or blank spaces allowed
4. No special symbol other than an underscore is allowed.

How does the computer understand what kind of variable we are formulating?
By using the following prefixes :
int – integer variable
float- real variable
char- character variable

C KEYWORDS or RESERVED WORDS


Keywords whose values are already assigned to the c compiler. You
cannot assign new values to the key words.
32 KEYWORDS IN C LANGUAGE

Compiler vedor specific keywords- near, far, asm. Such keywords must
be preceded by two underscores.
FORMS OF C PRROGRAMMING
Every c program must end with ; - statement terminator
COMMENTS IN A C PROGRAM
To be enclosed within /* */
can be written after or before a statement.
Comments cannot be nested that means a comment inside another
comment is invalid.
Comment can be split over lines.
WHAT IS main()
Program containing only one function have to be named main().
All statements that belong to main are enclosed within { }
Main() function always returns an integer value hence there is an int
before main
Some compilers like turbo C/C++ admits us to return nothing from
main() therefore we precede it with the word void.
C does not have a operator function for exponentiation
Printf() and its purpose
to display output on the screen
1. To be able to use printf(), it is necessary to use #include <stdio.h>
2. General form of printf() –
printf(“<format string>” , <list of variables >) ;

<format string> can contain ,


%f for printing real numbers
%d for printing integer values
%c for printing character value
ENGINEERING GRAPHICS VIDEOS
1. https://youtu.be/aLZyjyhA-wA?feature=shared
2. https://youtu.be/f6hokF1h8qA?feature=shared
3. https://youtu.be/nPxmbWbUlac?feature=shared
4. https://youtu.be/FwAIBCCke28?feature=shared
5. https://youtu.be/bhImBnfzvx0?feature=shared
6. https://youtu.be/KLrAZiddzvc?feature=shared
7. https://youtu.be/XwXUbcL7Lw4?feature=shared
8. https://youtu.be/ggh7qi-xouo?feature=shared
9. https://youtu.be/3MWW1Ng_1kw?feature=shared
10. https://youtu.be/1Eox7SvsYwA?feature=shared
11. https://youtu.be/JB4lWjDa7Gk?feature=shared
12. https://youtu.be/lxh-I6Kasiw?feature=shared
13. https://youtu.be/FL5UbYYsP64?feature=shared
14. https://youtu.be/R5YvR_T4BCw?feature=shared
15. https://youtu.be/ECubaN4eNmg?feature=shared
16. https://youtu.be/dzp8uxJbPjk?feature=shared
17. https://youtu.be/p3UHry5SKEg?feature=shared
18. https://youtu.be/9c0nkHY-1B0?feature=shared
19. https://youtu.be/EJXpSai_Sck?feature=shared
20. https://youtu.be/iXuUIRzDIwo?feature=shared
21. https://youtu.be/C_EIvENWlPc?feature=shared
22. https://youtu.be/zceVUhsDEpE?feature=shared
23. https://youtu.be/rgsD3C4uQoM?feature=shared
24. https://youtu.be/xwpqBPa0tRk?feature=shared
25. https://youtu.be/oUGjGryWtuM?feature=shared
26. https://youtu.be/eNsrueFanL0?feature=shared
27. https://youtu.be/3Tq9hCA5zYU?feature=shared
28. https://youtu.be/B_btLskfxXo?feature=shared
29. https://youtu.be/QlMMGnSe6bo?feature=shared
30. https://youtu.be/RBGgkwy0p_A?feature=shared
31. https://youtu.be/GVcKqim4K40?feature=shared
32. https://youtu.be/-UPmZSUQ8tU?feature=shared
33. https://youtu.be/NcvW9L5p6FU?feature=shared
34. https://youtu.be/DcNlm8JAfJc?feature=shared

1. Snap off- to draw between the grids


2. Snap on + readjust snap size- to draw accurately between grids
3. Arc- will be drawn in anti-clockwise sense
4. To draw arc in clockwise sense, simultaneously press the Ctrl
key.
5. PDMODE- 3 – for cross as point
6. Snap off- marks point- click line- mention start point- enter
node- click enter- draw line.
7. Dtext command to type text in the grid screen.
8. Hatch- command to fill pattern within a closed shape.
9. Array command- used to create repetitive patterns
10. Change command to change appearance of shape including
color.
11. Change- ltype- dshaed to created dashed line and centre to
make centre less wider.
12. The pline command helps makes shapes that on selection
form one entity.
13. Offset command helps make concentric figures.
14. The explode command helps break the pline drawn shapes
into single entities.
15. Pedit command help already made ine command figures
into pedit
16. Dimensions is used to determine dimensions of figures. 1
autocad unit= 100 mm
17.

PNS DOUBTS
1.A sign reads HOUSTON. Two letters are removed at random and then put back together again at
random in the empty spaces. What is the probability that the sign still reads HOUSTON?

2.Two persons throw a pair of dice once each. [That is, if persons A and B are playing then A throws a
pair of dice and then B throws a pair of dice.] What is the probability that the outcome pair of the 2
throws are same.

3.Given thirty distinguishable people, find the probability that among the 12 months of a year, there are
six containing two birthdays and six containing three. (Assume that each person is equally likely to be
born in each month of the year)

THERMO DOUBTS
1. A 5-kg piston in a cylinder with diameter of 100 mm is loaded with a
linear spring and the outside atmospheric pressure of 100 kPa. The
spring exerts no force on the piston when it is at the bottom of the
cylinder and for the state shown, the pressure is 400 kPa with volume
0.4 L. The valve is opened to let some air in, causing the piston to rise
2 cm. Find the new pressure

You might also like