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 SimpleConsoleTest by
Revision 2:80464803bc2f, committed 2017-10-12
- Comitter:
- CSTritt
- Date:
- Thu Oct 12 20:35:08 2017 +0000
- Parent:
- 1:a000e0121191
- Commit message:
- Cleaned up comments and output spacing.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a000e0121191 -r 80464803bc2f main.cpp
--- a/main.cpp Thu Oct 12 19:57:14 2017 +0000
+++ b/main.cpp Thu Oct 12 20:35:08 2017 +0000
@@ -3,23 +3,25 @@
File: main.cpp
Project: ArrayLimits
-//------------------------------------
-// Tera Term configurations
-// Terminal - New-line, Receive LF, Transmit LF
-// Serial port - Data 8 bit, Parity none, Stop 1 bit data, Flow control none.
-// Baud as specified below.
-//------------------------------------
-
-// Serial pc(SERIAL_TX, SERIAL_RX, 921600); // Highest Tera Term speed - works.
-// Serial pc(USBTX, USBRX, 115200); // Highest common speed - works.
-// Serial pc(USBTX, USBRX); // Default 9600 baud, alternate pin names - works.
+ Demonstrates abuse of array limits on Nucleo boards.
+
+ If necessary, avoid this with code like:
+
+ if (index > SIZE - 1) {
+ index = SIZE - 1;
+ } else if (index < 0) {
+ index = 0;
+ }
+ Use index...
+
+ Created by Dr. C. S. Tritt; Last revised 10/12/17 (v. 1.0)
*/
#include "mbed.h"
int main()
{
float a[] {1.0, 3.0, 5.0, 7.0, 9.0 };
- printf("Hello World !\n");
+ printf("Hello World !\n\n");
for (int i = 0; i > -10; i--) { // Displays zeros and one NaN.
printf("a[%d] is %f.\n", i, a[i]);
