Does your computer set aside storage for the variables in the order in which they wer
Does your computer set aside storage for the variables in the order in which they were declared?
Code:
#include <iostream.h>
using namespace std;
int main(){
short int shorty;
int num, count;
long date;
float yield;
double price;
cout << "Address of shorty: " << &shorty << endl << "\tSize in bytes: " << sizeof(shorty) << endl;
cout << "Address of num: " << &num << endl << "\tSize in bytes: " << sizeof(num) << endl;
cout << "Address of count: " << &count << endl << "\tSize in bytes: " << sizeof(count) << endl;
cout << "Address of date: " << &date << endl << "\tSize in bytes: " << sizeof(date) << endl;
cout << "Address of yield: " << &yield << endl << "\tSize in bytes: " << sizeof(yield) << endl;
cout << "Address of price: " << &price << endl << "\tSize in bytes: " << sizeof(price) << endl;
return 0;
}
/*
*OUTPUT OF PROGRAM*
Address of shorty: 0012FF8A
Size in bytes: 2
Address of num: 0012FF84
Size in bytes: 4
Address of count: 0012FF80
Size in bytes: 4
Address of date: 0012FF7C
Size in bytes: 4
Address of yield: 0012FF78
Size in bytes: 4
Address of price: 0012FF70
Size in bytes: 8
*/
So what does this mean?