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.
ProductionCode.c
00001 00002 #include "ProductionCode.h" 00003 00004 int Counter = 0; 00005 int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. 00006 00007 // This function is supposed to search through NumbersToFind and find a particular number. 00008 // If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since 00009 // NumbersToFind is indexed from 1. Unfortunately it's broken 00010 // (and should therefore be caught by our tests) 00011 int FindFunction_WhichIsBroken(int NumberToFind) 00012 { 00013 int i = 0; 00014 while (i <= 8) //Notice I should have been in braces 00015 i++; 00016 if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! 00017 return i; 00018 return 0; 00019 } 00020 00021 int FunctionWhichReturnsLocalVariable(void) 00022 { 00023 return Counter; 00024 }
Generated on Mon Aug 29 2022 19:53:41 by
