暨南大学2021计组实验1.docVIP

  • 2
  • 0
  • 约2.23千字
  • 约 3页
  • 2022-12-26 发布于广东
  • 举报
Lab 1: Number Storage Lab 1 Introduction This lab extends the section Information Storage (chapter 2) in the textbook. It will immerse you in a problem context, which will require you to apply the theoretical concepts taught in the C language course. This will help you to develop basic skills needed to become a device level system developers and digital system designer. While going through this lab concentrate on developing a good understanding of the problem context, as it is a fundamental requirement for becoming a skilled system designer or application developer. 2 Type This is an individual project. 3 Instructions You are provided with the C program. This code (file name “lab1.c”) is available from the course materials. Activities to do- a) Using less than 4 sentences, explain what function/action, the two statements marked with “Tag 1” and “Tag 2” perform. b) Compile and run this program with “gcc” on the Linux machine. c) When you ran your code, did you get the time executed to be negative? If yes, why did that happen? (Since time cannot be negative). How could you fix this? Figure out how to fix it and do the necessary modifications. d) Change the data type of the variable time_stamp from double to long int. Is there a change in the values reported? If so, which of the values is the correct value? Why is there a difference? e) Find out the structure of type “timeval”. Is it a standard C data type or is it platform specific? f) Print your output files for all runs in your report. (and the fixed versions if you made changes above ). Note: If you submit an output file with negative time, you must submit the corrected version also. Failure to do so will lead to loss of 50% of the points for this lab. g) Write a C program to get bit and byte lengths for all the following C numerical data types according to the following table. The new C code file should have name “lab1_2.c” and it should generate an output file named “lab1_2_out.txt”. Hint – You can add codes to

文档评论(0)

1亿VIP精品文档

相关文档