It is used to store real numbers with single precision ie a precision of 6

It is used to store real numbers with single

This preview shows page 27 - 35 out of 35 pages.

It is used to store real numbers with single precision i.e. a precision of 6 digits after decimal point. Quick yak: Some common foat examples are: Speed of ball CGPA Precise distance between two cities
Image of page 27
©LPU CSE101 C Programming Format specifier is %f. The type modifier for float are float , double and long double. The rational number written in red box of My- Car problem are the float numbers. 3.14 3.14 94.2 94.2
Image of page 28
©LPU CSE101 C Programming Type Float Double Long double Storage Size 4 byte 8 byte 10 byte Value range 3.4e-38 to 3.4e+38 1.7e-308 to 1.7e+308 3.4e-4932 to 1.1e+4932 Precision 6 decimal places 15 decimal places 20 decimal places Example pi= 3.141592 3.141592741012573 3.14159265358979323846
Image of page 29
©LPU CSE101 C Programming Character It stores a single character of data belonging to the C character set. The alphabets written in blue box of My- Grades problem are the character. A A A A C C B B D D Quick yak: Character data type examples: First alphabet of your name Grades Directions: N E W S
Image of page 30
©LPU CSE101 C Programming It occupies 1 byte of memory. Format specifier is %c . The range is 0 to 255 for unsigned char. The range is -127 to 127 for signed char. Each char type has an equivalent integer interpretation, ASCII value, so that a char is really a special kind of short integer. char choice=‘y’;
Image of page 31
©LPU CSE101 C Programming Format Specifier Specifies the format according to which the value will be printed on screen in C. Example: %d : signed integer %ld: long integer %u : unsigned integer %c : single character %f : float %s : string %i : int
Image of page 32
©LPU CSE101 C Programming Remember car example? 15 15 3.14 3.14 Program 90 90 %d %d %d 15 15 3.14 3.14 Program 94.2 94.2 %f %d %f
Image of page 33
©LPU CSE101 C Programming Grade example: 84 84 97 97 58 58 64 64 34 34 Program A A A A C C B B D D %d %d %d %d %d %c %c %c %c %c
Image of page 34
©LPU CSE101 C Programming [email protected] Next Lecture: Constants Variables Expressions
Image of page 35

You've reached the end of your free preview.

Want to read all 35 pages?

  • Spring '18
  • Aman
  • Long integer, Short integer

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors