#include #include #include #include #define MAXSIZE 200 #define ARRAYMAX 4 // int imnotallowedvar = 50; int fred(int value, int list[ARRAYMAX]); int george(int val); int main(void) { float barney; short a, b, c; int d = 0, po2 = pow(2,3); int loop; int array1[4] = {0}; float array2[] = {2.14, 3.14, 1718.0}; char string1[] = {'S','h','a','n','e', '\0'}; char string2[] = "Shane"; array1[d] = 9; array1[2] = 88; for (loop = 0; loop < 4; loop++) { // printf("\n Enter a value to go in the array: "); // scanf("%d", &array1[loop]); // printf("\n array1 [ %d ] = %d ",loop,array1[loop]); printf("\t %c %c", string1[loop], string2[loop]); } fred(1, array1); printf("\n %s %s",string1, string2); printf("\n"); /* b = 32670; c = b; a = b+ c; d = b + c; printf("a is sum of b and c = %hd, b = %hX, c = %hX, maxshrt = %X or %d, \n d= %X or %d, max int = %d\n", a,b,c,SHRT_MAX,d, INT_MAX); printf("Hi! I'm po2 from pow %d \n",po2); barney = 6; printf("Barney is %f\n",barney); george((int)barney); */ return 0; } int fred(int value, int list[ARRAYMAX]) { int wvalue = MAXSIZE; int dvalue = 0; printf("\n Inside function fred, list [ %d ] is %d",value,list[value]); //printf("Wilma is %d\n",wvalue); /* Commenting out the next two lines for testing */ wvalue++; // += 1; // printf("Wilma is %d\n",wvalue); wvalue = 0; // *= (3 + 7); // wv * 3 + 7 or wv * (3 + 7) //printf("Wilma is %d before if \n",wvalue); /* if (wvalue <= 50) { printf("How old is Wilma? (Please enter an integer less than 21) "); scanf("%d",&wvalue); if (wvalue < 21) printf("Good job!"); else while (wvalue >= 21) { printf("Please follow the instructions. Re-enter a number < 21: "); scanf("%d",&wvalue); } } else if (wvalue < 100) { if ((54 < wvalue) && (wvalue < 62)) { printf("Wilma is an odd old bat\n\n"); } else { printf("Wilma is an even older bat\n\n"); } } else { printf("Wilma is ancient\n\n"); } */ // printf("Wilma is %d\n",wvalue); // printf("Fred says he is %d and Wilma is %d \n",value,wvalue); value += ++wvalue; dvalue = 2*value; // printf("Now Fred says he is %d and Wilma is %d and Dino is %d\n",value,wvalue,dvalue); return wvalue; } int george(int val) { int jane, elroy, judy, astro, c; printf("\nPlease enter 4 integers seperated by spaces: "); scanf("%d %d %d %d",&jane, &elroy, &judy, &astro); printf("\nYou entered %d, %d, %d, and %d\n",jane, elroy, judy, astro); // for c in range(1,11): Python for (c = jane ; c < astro++ ; judy +=3 ) { judy++; printf("c is %d and astro is %d and judy is %d\n",c, astro, judy); c += 4; } }