These homeworks are not graded. However, we strongly encourage you to do this and leave a copy in /afs/andrew/course/15/123/handin/homework/yourID 2.1 : The sizeof operator gives the number of bytes required to store a variable of the type. Write a program to find, sizeof an int, short, double, char, float, an array of 100 ints. Which library contains sizeof function? Be sure to include that. 2.2 : Write a program that will open a bmp file, read each byte and print the value of the byte as an unsigned int. Hint: use fread (see lecture 02) and stdio and stdlib 2.3 : write a program to read a file of words and count the words in the file. create your own file and test the program. ANSWERS 2.1 : The sizeof operator gives the number of bytes required to store a variable of the type. Write a program to find, sizeof an int, short, double, char, float, an array of 100 ints. Which library contains sizeof function? Be sure to include that. int A[100]; printf("%d %d %d %d %d %d \n", sizeof(int), sizeof(double), sizeof(long), sizeof(char) sizeof(float), sizeof(A)); 2.2 : Write a program that will open a bmp file, read each byte and print the value of the byte as an unsigned int. Hint: use fread (see lecture 02) and stdio and stdlib FILE* fp = fopen("image.bmp", "r"); char buffer[10000]; /* assume image is 10000 bytes */ fread(fp,10000,1,buffer); for (i=0; i<10000; i++) printf("%u ", buffer[i]); 2.3 : write a program to read a file of words and count the words in the file. create your own file and test the program. FILE* fp = fopen("file", "r"); int i=0; char buf[50]; while (fscanf(fp,"%s",buf)>0) i++; return i;