Andy Pomfret
/
UoY-32C-lab4-2
Template project for University of York ELE00032C Lab 4
main.cpp
- Committer:
- ajp109
- Date:
- 2021-01-16
- Revision:
- 2:3e6493621bc9
- Parent:
- 1:8290f84652d1
File content as of revision 2:3e6493621bc9:
#include "mbed.h" struct IntVector { int x; int y; }; unsigned long long modSquared(IntVector vector) { return vector.x*vector.x + vector.y*vector.y; } int main() { IntVector p; IntVector q; p.x = -3; p.y = 1; q = p; q.x = 4; printf("(%d, %d). Mod-squared %llu\r\n", q.x, q.y, modSquared(q)); printf("(%d, %d). Mod-squared %llu\r\n", p.x, p.y, modSquared(p)); // Do nothing, forever... while (true); }