Sie sind auf Seite 1von 1

Lab #1: Arrays, Pointers and Structures Question #1: Arrays

Write a program which prints the letters in a char array in reverse order. For example, if the array contains {'b', 'a', 'p', 't', 'i', 's', 't', 'e'}the output (to the terminal) should be "etsitpab".

Question #2: Pointers


Write a short C program that declares and initializes (to any value you like) a double, an int, and a char. Next declare and initialize a pointer to each of the three variables. Your program should then print the address of, and value stored in, and the memory size (in bytes) of each of the six variables. Use the 0x%x formatting specifier to print addresses in hexadecimal. You should see addresses that look something like this: "0xbfe55918". The initial characters "0x" tell you that hexadecimal notation is being used; the remainder of the digits give the address itself. Use the sizeof operator to determine the memory size allocated for each variable.

Question #3: Records


Write a C program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex, quizzes Scores (2 quizzes per semester), mid-term score, final score, and total score. The program will prompt the user to choose the operation of records from a menu as shown below: ============================================ Menu ============================================ 1. Add student records 2. Delete student records 3. Update student records 4. View all student records 5. Calculate an average of a selected students scores 6. Show student who gets the max total score 7. Show student who gets the min total score 8. Find student by ID 9. Sort records by total scores Enter your choice:1 Note: All students records store in an array of structures

Das könnte Ihnen auch gefallen