/* * Assignment.Ch3.txt * By: John Stile */ 1. What is wrong with the following code? #include int main(void) { float value; // Change int to float, as this will store a floating pointn number char greet = "Hello, how are you?"; value=586.35; printf("%s", great); // changed %c to %s to print all of array printf("%.2f", value); // changed this to print the floating point number return 0; } 2. If C does not have a variable type string, why is there a %s used in printf and scanf? The %s allows one to print an array of characters, or list. 3. How much memory is consumed to hold hte digit string 775 and how much memory to hold integer 775? char takes up 8 bits, multiply by 3 = 32 bits. int takes up 16 or 32 bits, multiply by 3 = 48 or 96 bits. 4. Write a function called dif2 that accepts 2 floating point arguments, subtracts the first from the second, and then output the difference. Put the function in a program and make it work. Comment the code. Program is called Assignment.problem4.Ch3.c 5. What is the difference between a variable and a string definition? The variable is a single item in memory. An string defition declares an array of char variables.