![](/media/cache/profiles/1becf26e9f32353e30870060538746e7.50x50_q85.jpg)
Simple training demonstration to show the use of union and structure
Fork of OddExample2 by
main.cpp
- Committer:
- jf1452
- Date:
- 2013-11-26
- Revision:
- 9:0add51bbe65d
- Parent:
- 8:c0d351fc572f
- Child:
- 10:6c0cd51df4df
File content as of revision 9:0add51bbe65d:
/******************************************************************************* * This program demonstrates determines if a number is odd or even * * * * Jon Fuge * * V1.0 26/11/2013 First issue of code * *******************************************************************************/ #include "mbed.h" #include "USBSerial.h" USBSerial serial; //Virtual serial port over USB. Use Teraterm as the interface int main() { char cMyNumber = 53; // Set it to an odd number wait (10); // Wait 10 seconds to connect port if ((cMyNumber & 0x01) == 1) serial.printf("%i is odd\n\r", cMyNumber); else serial.printf("%i is even\n\r", cMyNumber); for(;;) {} // Loop forever }