M2 34 G2 M3 97 G3 M4 58 G4 M5 64 G5 84 84 A A 34 34 A A C C B B D D 97 97 58 58

M2 34 g2 m3 97 g3 m4 58 g4 m5 64 g5 84 84 a a 34 34 a

This preview shows page 19 - 28 out of 35 pages.

M2= 34 , G2=? M3= 97 , G3=? M4= 58 , G4=? M5= 64 , G5=? 84 84 A A 34 34 A A C C B B D D 97 97 58 58 64 64 Marks as integer Grades as character char in C char in C char in C char in C char in C
Image of page 19
©LPU CSE101 C Programming Classification of Data Types In C data type is broadly classified as: Basic data types Derived data types User defined data types
Image of page 20
©LPU CSE101 C Programming
Image of page 21
©LPU CSE101 C Programming List of Data Types Type Size (bytes) Minimal range char 1 -128 to 127 unsigned char 1 0 to 255 int 2 or 4 -32768 to 32767 unsigned int 2 or 4 0 to 65535 short int 2 -32768 to 32767 unsigned short int 2 0 to 65535 long int 4 -2147483648 to 2147483647 unsigned long int 4 0 to 4294967295 float 4 3.4e-38 to 3.4e+38 with 6 digits of precision double 8 1.7e-308 to 1.7e+308 with 15 digits of precision long double 10 3.4e-4932 to 1.1e+4932 with 20 digits of precision
Image of page 22
©LPU CSE101 C Programming Integer It is used to store positive and negative counting numbers, as well as zero. {...,-2,-1,0,1,2,...} The numbers written in green box of My-Car problem are the integers. 15 15 84 84 34 34 97 97 Quick yak: Some integers used in common are: No. of steps in staircase Wheels in an automobile
Image of page 23
©LPU CSE101 C Programming The type modifiers for the integer data type are: signed, unsigned, short, long . Signed types represent positive and negative numbers. Unsigned represent zero and positive numbers only. Long and short represent the range of integer number
Image of page 24
©LPU CSE101 C Programming Long Integer Occupies 4 bytes in memory. Format specifier is %ld. Range is -2147483648 to 2147483647 long radius=123456; long int value ; Short Integer Occupies 2 bytes in memory. Format specifier is %d or %i. Range is -32768 to 32767. By default int variable is short signed int. int cost=100; short int si;
Image of page 25
©LPU CSE101 C Programming Signed Integer Occupies 2 bytes in memory Format specifier is %d or %i There are also long signed integers having range from -2147483648 to 2147483647 Example: int firstvalue=10; long int WaterLevel ; Unsigned Integer Occupies 2 bytes in memory Format specifier is %u . There are also long unsigned int with range 0 to 4294967295 Example: unsigned long count=567898; unsigned short int page;
Image of page 26
©LPU CSE101 C Programming Float Floating point numbers are real numbers that, unlike integers, may contain fractional parts of numbers, like 1.446 , -112.972 , 3.267e+27 .
Image of page 27
Image of page 28

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