1. a) function calls: printf("%d\n", foo(1,2)); (there are actually two function calls here - foo and also printf (remember, printf is just a function, one that happens to have already been written) b) function implementation: int foo(int one, int two) { return one+two; } c) function prototype int foo(int,int); note that you don't actually have to include a variable name in the prototype - int foo(int num1, int num2); will also work but you don't need to include num1 and num2. This is different from the actual function definition, in which you do need to include variable names, since how else could you refer to the paramters? But the purpose of the function prototype is just to say what types of variables the function takes as parameters, and what it returns. =========================================================== 2. a. 1. sum = sumFun(int intArray[]); ^^^ ^^ don't put int or [] here 2. length is used in sumFun but not declared anywhere 3. sum is not initialized to 0 in sumFun b. 1. changeToKilos(*weight) This should be changeToKilos(&weight), since changeToKilos is expecting a pointer to a double as the paramaeter. 2. weight=weight/POUNDS_PER_KILO This should be *weight=(*weight)/POUNDS_PER_KILO since weigth is a pointer to a double, so to refer to the actual value, use *weight 3. scanf("%lf",weight) should be scanf("%lf",&weight), since scanf takes the address of a variable - you don't need to know this =========================================================== 3. for (i=0; i<3; i++) { for (j=4; j>=0; j--) { printf("%c",c[i][j]); } } =========================================================== 4. a. cardT hand[5]={ {TWO,CLUBS}, {THREE, DIAMONDS}, {FOUR,SPADES}, {JACK,DIAMONDS}, {QUEEN,HEARTS}}; b. int i; hand[0].rank=ACE; hand[0].suit=HEARTS; for (i=1; i<5; i++) { hand[i].rank=hand[0].rank-1; hand[0].suit=HEARTS; } =========================================================== 5. put a break; statement after each printf (don't need it after the default printf =========================================================== 6. This is a pretty silly question. The effective length will be either 20, the maximum length, or the number of characters entered, not coounting '\n' =========================================================== 7. void main() { int total=0; int numEntered=0; int val; while (TRUE) { printf("Enter test score:"); val=GetInteger(); if (val<0) { break; } total+=val; numEntered++; } printf("The average is %f\n", ((double)total)/numEntered); } =========================================================== 8. typedef struct { int id; int hw[6]; int midterm; int final; double avg; char grade; } studentInfoT; void main() { char studentInfoT studentInfo[12]; } =========================================================== 9. void convert(char c[], int size) { int i; int diff='a'-'A'; for (i=0; i='A' && c[i]<='Z') { c[i]=c[i]+diff; } else if (c[i]>='a' && c[i]<='z') { c[i]=c[i]-diff; } } } =========================================================== 10. var1: int* (pointer to int) var2: int var3: double var4: struct, with at least one field int phoneNumber var5: struct* (pointer to structure), where the structure contains at least the field person, which is of the same structure type as var4. var6: *struct (pointer to structure), where the structure contains at least the field int age =========================================================== 11. a. forget it - we didn't do sorting. b. add "int results[1000]" after "int i,roll;" add "results[i]=roll" after "roll=throwDie();" =========================================================== 12. forget it - you don't need to know scanf