#include /* * Example from Sep 19, 2013 * Yes * a comment * */ #define FAHRFREEZE 32 #define CELCFREEZE 0 #define MAXVALS 10 #define MAX 20 #define BIGSEARCH 25 //int z = 8; //A global variable will get a 0 on your lab in Dr T's class int howdyfunc(int arr[], int a); int main(void) { int celsius_temp = 0, d, e, fahrenheit_temp= 42, c=0, f= 42, x, i, j, k; double stockinfo[6][4] = {{4, 1.99, .25},{0,0,0}, {12, 87.95, 2.50}}; int multiD[2][3][4][5] = {{{{0}}}}; int scorelist[BIGSEARCH] = {90,87,88,79, 45, 98, 32, 99, 100, 46, 67,68}; float classavgs[20]= {0}; char nameclass[ ]= {'C','_','c','l','a','s','s','\0'}; char nameclass2[ ]="C 1320"; char notstring[ ] = {'f','o','o','t'}; double stockprice[6]={0}; char stocktype[6]={'X','A'}; char sti; int se = 68; int linresult; char words[6][40]={{0}}; x = 7; k=-1; // Before starting a search, you need to know the characteristics of your data // data type, size, unsorted or sorted, are duplicates allowed, valid range, etc. linresult = linsearch(scorelist,BIGSEARCH,se ); if (linresult == -1) { printf("\n Sorry, Charlie. Search element not found. "); } else { printf("\n Search element %d found at index %d", se, linresult); } /* */ //printf("You entered d= %d and e= %d. d+c*e where c= %d is %d\n",d,e,c,f); //c = howdyfunc(e, d); //printf("\nHello world %d\n Print a quote \" \n", howdyfunc(e,d) ); //quizfunc(c, f); return 0; } //Linear search - any data type, any size array, unsorted, assume no dupes //Searching for what element - same type as data in array int linsearch(int sl[], int maxsize, int searchelement) { int index = 0; int foundat = -1; printf("\nIn linsearch, searchelement is %d and maxsize is %d\n",searchelement, maxsize); // for( index = 0; (index < maxsize)&&(sl[index] != searchelement) ; index++) for( index = 0; (index < maxsize); index++) { if (sl[index] == searchelement) foundat = index; printf("\nIn for loop, sl[%d] is %d\n", index, sl[index]); } //foundat = index; printf("\nIn linsearch, foundat is %d\n",foundat); return foundat; } int howdyfunc(int arr[], int asz) { int c = -543; //printf("Howdy!! \n"); printf("\nbegin asz is %d",asz); for (c=0; c