Compare commits

..

5 Commits

Author SHA1 Message Date
Jidong Xiao
ddba0c00d3 no diagrams 2025-01-22 12:27:50 -05:00
Jidong Xiao
c87d05085b fall 23 to spring 25 2025-01-22 12:27:50 -05:00
Jidong Xiao
8eba07df5d show it as a question 2025-01-22 12:27:50 -05:00
Jidong Xiao
f4232e8c1b remove the name 2025-01-22 12:27:50 -05:00
Jidong Xiao
81b8266571 no name space 2025-01-22 12:27:50 -05:00
3 changed files with 9 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
# Lab 3 — Memory Diagrams, Testing, and Debugging
# Testing, and Debugging
For this lab, you must use a terminal. Do not use IDEs for this lab.
@@ -136,7 +136,7 @@ figure out how to do each of the steps below in your debugger of choice.
Note that in addition to a standard step-by-step program debugger like gdb/lldb, we also recommend the use
of a memory debugger (drmemory or valgrind) for programs with dynamically-allocated memory (well soon talk about this in Lectures), or anytime you have a segmentation fault or other confusing program behavior. Well work the memory debugger in lab next week! Information about memory debuggers is
available here:
http://www.cs.rpi.edu/academics/courses/fall23/csci1200/memory_debugging.php
http://www.cs.rpi.edu/academics/courses/spring25/csci1200/memory_debugging.php
After todays lab, you should be comfortable with the basics of command line debugging within your preferred
development environment. Keep practicing with the debugger on your future homeworks, and be prepared

View File

@@ -170,20 +170,19 @@ ClassName& operator=(const ClassName& other);
```cpp
#include <iostream>
#include <string>
using namespace std;
class MyClass {
private:
string name; // Using a standard string (no pointers)
std::string name;
public:
MyClass(const string& initName) : name(initName) {}
MyClass(const std::string& initName) : name(initName) {}
MyClass& operator=(const MyClass& other) {
name = other.name; // Copy data
return *this;
}
void print() const { cout << "Name: " << name << endl; }
void print() const { std::cout << "Name: " << name << std::endl; }
};
int main() {

View File

@@ -22,8 +22,9 @@ else
cout << "Smaller\n";
```
The output is Bigger
because x == 72.0. Whats going on?
The output is ?
<!-- Bigger
because x == 72.0. Whats going on?-->
![alt text](pointer_init.png "pointer_init")
@@ -198,7 +199,7 @@ for ( i=0; i<n; ++i ){
};
```
This second approach also "nicely mimics the subscript notation used in the (original) for loop above, which highlights that fundamentally array subscripts are just pointer arithmetic." - comments by our mentor Eleanor Olson, :smile:.
This second approach also "nicely mimics the subscript notation used in the (original) for loop above, which highlights that fundamentally array subscripts are just pointer arithmetic." - comments by a former mentor.
## 5.9 Sorting an Array