0% found this document useful (0 votes)
104 views

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

1. The document contains questions about arrays, pointers, and structures in C programming. 2. The first question asks to write a program that prints the letters in a character array in reverse order. 3. The second question asks to declare variables, initialize them, declare pointers to the variables, and print the addresses, values, and sizes of each. 4. The third question asks to write a program to store and perform analysis on records of 20 students using an array of structures. The program will include a menu to add, delete, update, view records and perform calculations on the student data.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views

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

1. The document contains questions about arrays, pointers, and structures in C programming. 2. The first question asks to write a program that prints the letters in a character array in reverse order. 3. The second question asks to declare variables, initialize them, declare pointers to the variables, and print the addresses, values, and sizes of each. 4. The third question asks to write a program to store and perform analysis on records of 20 students using an array of structures. The program will include a menu to add, delete, update, view records and perform calculations on the student data.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like