Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ArraySizeof by
Diff: main.cpp
- Revision:
- 0:8482415bf245
- Child:
- 1:987d0ca5cf9a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 23 01:15:43 2017 +0000 @@ -0,0 +1,33 @@ +/* + Project: GradeAverage + File: main.cpp + Ported to mbed/Nucleo by: Dr. C. S. Tritt + Last revised: 10/22/17 (v. 1.0) + + Program 5.5 Using the & operator - from Beginning C, 5th ed. Ivor Horton. + +*/ +#include "mbed.h" + +int main(void) +{ + // Define some integer variables. + int a = 1; + int b = 2; + int c = 3; + + // Define some floating-point variables. + float d = 4.0f; + float e = 5.0f; + float f = 6.0f; + + printf("\nVariables of type int occupy %u bytes each.", sizeof(int)); + printf("\nHere are the addresses of some type int variables --"); + printf("\nThe address of a is: %p.\nThe address of b is: %p.", &a, &b); + printf("\nThe address of c is: %p.", &c); + printf("\n\nVariables of type float occupy %u bytes each.", sizeof(float)); + printf("\nHere are the addresses of some type float variables --"); + printf("\nThe address of d is: %p.\nThe address of e is: %p.", &d, &e); + printf("\nThe address of f is: %p.", &f); + while (true) {} // Loop forever when done. +} \ No newline at end of file