It's UWAweek 47

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying the 3 articles in this topic
Showing 3 of 828 articles.
Currently 96 other people reading this forum.


 UWA week 30 (2nd semester, week 1) ↓
SVG not supported

Login to reply

👍?
helpful
5:28pm Thu 25th Jul, Jinyoung L.

According to the slide 2, page 4 in Variables, the page says that "A typical C program will use 4 bytes to hold a single integer value, or 8 bytes to hold a single floating-point value." It this correct? Integer value has 2 or 4 bytes and a single floating-point value has 4 bytes? I am confused.


SVG not supported

Login to reply

👍?
helpful
9:17pm Thu 25th Jul, Joshua N.

Hey Jinyoung
> According to the slide 2, page 4 in Variables, the page says that "A typical C program will use 4 bytes to hold a single integer value, or 8 bytes to hold a single floating-point value." > > It this correct?
If I remember correctly floats are 4 bytes and doubles are 8 bytes (hence the name double) but Chris may need to clarify.
> Integer value has 2 or 4 bytes and a single floating-point value has 4 bytes? > I am confused.
An integer value must be at *least* 2 bytes (or 16 bits) but it is *usually* 4 bytes (32 bits). It's a bit confusing because different systems will use a different number of bytes to represent an int, however a 32/64 bit system should use 32 bits. So, it should be safe to assume it is just 4 bytes (32 bits). However, there are types you can use that guarantee the number of bytes used (these are called **Fixed width Integer types**). Not sure if you guys will need them in this unit. The *more bytes* (or bits) used the *larger the number* that can be represented. I hope that helps.


SVG not supported

Login to reply

👍?
helpful
1:01pm Fri 26th Jul, Jinyoung L.

Thank you very much :)

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy