Description
Purpose: Learn how to use array in C. Understand the basic memory address in C.
Part 1:
Write a C program named as getMostFreqChar.c that finds the most frequent letter from the input via ignoring the case sensitive and prints out its frequency. For example, sample outputs could be like below
Part 2:
When a variable is stored in memory, it is associated with an address. To obtain the address of a variable, the & operator can be used. For example, &a gets the memory address of variable a. Let’s try some examples.
Write a C program addressOfScalar.c by inserting the code below in the main function.
Questions:
1) Run the C program, attach a screenshot of the output in the answersheet.
2) Attach the source code in the answer sheet
2) Then explain why the address after intvar is incremented by 4 bytes instead of 1 byte.
Part 3:
Write a C program addressOfArray.c by inserting the code below in the main function.
Questions:
1) Run the C program, attach a screenshot of the output in the answer sheet.
2) Check the address of the array and the address of the first element in the array.Are they the same?
3) Write down the statement to print out the length of the array by using sizeofoperator.
Submission:
Upload an electronic copy (pdf) of your answer sheet to the folder named “Lab 9” in Google Classroom
Please add the lab assignment number and your name at the top of your answer sheet.
Upload the C files getMostFreqChar.c, addressOfArray.c and addressOfScalar.c to the folder named named “Lab 9” in Google Classroom
Name your file in the format of Lab9_ FirstnameLastname (e.g Lab9_FilRondel.pdf)
Reviews
There are no reviews yet.