UCSB Science Line
Sponge Spicules Nerve Cells Galaxy Abalone Shell Nickel Succinate X-ray Lens Lupine
UCSB Science Line
Home
How it Works
Ask a Question
Search Topics
Webcasts
Our Scientists
Science Links
Contact Information
Why does c++ have long and int (4 byte integers)? Why have two words for the exact same data structure?
Question Date: 2021-10-27
Answer 1:

The C++ standard specifies that an int be the "natural" size for the processor, which may not always be as big as a long.

The standard also guarantees that a long is at least as long as an int , so the fact that they are equal sizes are not always guaranteed.

Read about here.



Click Here to return to the search form.

University of California, Santa Barbara Materials Research Laboratory National Science Foundation
This program is co-sponsored by the National Science Foundation and UCSB School-University Partnerships
Copyright © 2020 The Regents of the University of California,
All Rights Reserved.
UCSB Terms of Use