1. (10pts) What is the value (in decimal) of X in each case below? Give the expression based on which you arrive at your value. Assume 4 bytes are used to store int and float, 8 for long and double. a. int X b. float X x sizeof[char)/ (float) sizeof10 c. int C- 4: 2. (20pts) Rewrite the following program using macro definitions (adefine) for all the constants and a new type definition (typedef) called Card for all the values representing the value of cards You can use letter Tto represent the value of Card Ten Winclude
int main(void) char selectedCard printf("Choose a cardn" scanf("%c", &selectedCard); if (selectedCard s-71 l selectedCard "" 11 selectedCard "'K) { printfl You earn 10 pointsn } else if ((selectedCard >'S' && selectedCard c, y} l l selectedCard "" )( between 5 and 9 or equal to T for Ten printfl"You earn 2 ptsn"l } else if (selectedCard ** "I') { printfl"You earn 20 ptsin) l else ( printfl"No cheating allowed. You earn O ptsn return 0; . (15pes) Declare a character areay of sie 20. wnite a loop to initialae the array with consecutive letters starting at the letter 4 (10pt) Declare a two-dimensional int array of size 4 8frow x column) and initialae the it element of every row to 6 and the remaining elements to O at the same time of declaration Uhe as short statement wherever possible. The following problems are assigned for Lecture 23 Functions I Do them afher the lecture 5 (15pes Write a function called solowercane that takes a character variable letser as input and retums it into lowercase. If letter is already lowercase or a number from 0t0 9, do not change n. For example, if letter , return V letter or Vreturn thesa ne letter. 6. (15pts) What s the output of the following program? Explain how you get the value. int expandlint number, int factor) int main(void)[ intx 3 printf Nd %dW', espandts+ 1, 4), expand(expand(m2, 3L-30k return O (15 pt) Fix three errors in the following program nt mainlvoid) [ char bi) [A char tagetT; copy atray a into array b: Look for tanget in array a: 1a1) .. target printfl"Tound it return O