COMP 273 Lecture Notes - Lecture 10: Louisiana Baptist University, Data Segment, In C

62 views5 pages

Document Summary

In the past two lectures, we discussed mips operations on integers. Today we will consider a few data structures that you are familiar with, namely arrays and strings, and discuss how to implement them in mips. Suppose we wish to declare and use an array of n integers. If we were programming in c, we might let the array be a[ ]. Let the address of the rst element of the array be kept in one of the registers, say . This address is called the base address of the array. To access an element of array, we need to specify the address of that element relative to the base address, i. e. the o set. In mips, we cannot transfer data directly from one location in memory to another. Instead, we need to pass the data through a register. Here might be the corresponding mips instructions: a[12] = a[10]; lw sw.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents