Assignment 2, due Sep 5
Part of
the homework for CS:2630, Fall 2019
|
On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper in discussion section on Thursday. Some parts of assignments may be submitted on-line and completed in discussion section. Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!
a) 01011101
b) 11100010
c) 01101010
d) 11110011
e) 01111011
const void * const a = NULL; const void * const b = &a; const void * const c = &b;
Note that const void * x declares x to be a pointer to a constant value, while void * const x declares x to be a constant-valued pointer to a variable. The above three declarations declare constant-valued pointers to constant values. That is to say, the pointers can be stored in read-only memory and the values to which they point might as well be in read-only memory as well. The fact that these are void pointers suppresses lots of type checking but plays little role in this assignment.
Note that, by default, everything you assemble with the SMAL assembler gets put in read-only memory.
A problem: Write SMAL code equivalent to the above. Note, it can be written in 3 lines of code and it would be foolish to expand it beyond 6 lines (what you get by putting labels on separate lines from the word they label). (1.0 points)