Skip to content

Commit

Permalink
Fixed the first activity and updated the schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
nouredd2 committed Aug 31, 2021
1 parent e9a015f commit a6315f8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ round-avatar: true
# If you want to have an image logo in the top-left corner instead of having the title of the website,
# then specify the following parameter
#title-img: /path/to/image
gh_repository_url: "https://github.com/rhit-csse332/csse332-202130"
gh_activity_url: "https://github.com/rhit-csse332/csse332-202130/tree/main/activities"
gh_homeworks_url: "https://github.com/rhit-csse332/csse332-202130/tree/main/homeworks"
gh_repository_url: "https://github.com/rhit-csse332/csse332"
gh_activity_url: "https://github.com/rhit-csse332/csse332/tree/main/activities"
gh_homeworks_url: "https://github.com/rhit-csse332/csse332/tree/main/homeworks"



Expand Down
5 changes: 5 additions & 0 deletions _data/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
materials:
other:
# - <a href="{{ site.baseurl }}/sessions/02_session2/"> Session Information </a>
- <a href="https://rosehulman-my.sharepoint.com/:p:/g/personal/noureddi_rose-hulman_edu/Ed5xz_-IYohJkY181epr6f4BGXWhlPajqlUpqVpbMKwBvg?e=bR0qAw"> Slides </a>
- No activity today
2:
reading:
topics:
Expand All @@ -17,6 +19,9 @@
materials:
other:
# - <a href="{{ site.baseurl }}/sessions/01_session1/"> Session Information </a>
- <a href="https://rosehulman-my.sharepoint.com/:p:/g/personal/noureddi_rose-hulman_edu/EcmqJLbNxRNPuUiRgvmIEBEBVUyjWk4wvoDA8wdlhZw-xg?e=c0WMVI"> Slides </a>
- <a href="{{ site.gh_activity_url }}/01_pointers"> Activity </a>
- <a href="https://moodle.rose-hulman.edu/mod/assign/view.php?id=2933248"> Activity Submission </a>

# 3:
# reading:
Expand Down
14 changes: 3 additions & 11 deletions activities/01_pointers/al_activity.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ void do_nothing() {
}

int main() {
int nums[NUM_MAX];
struct array_list *mylist;

// mylist = array_list_new(do_nothing);
Expand All @@ -90,28 +91,19 @@ int main() {

// adds a bunch of numbers to the list
for(int i = 1; i <= NUM_MAX; i++) {
int *memory = malloc(sizeof(int));
*memory = i;
printf("allocating %p %d\n", memory, *memory);
array_list_add(mylist, memory);
nums[i-1] = i;
array_list_add(mylist, &nums[i-1]);
}

// removes a couple randomly
for(int i = 1; i <= NUM_TO_DELETE; i++) {
int rand_index = rand() % array_list_length(mylist);

int* memory = array_list_get_idx(mylist, rand_index);
printf("freeing %p %d\n", memory, *memory);
array_list_del_idx(mylist, rand_index, 1);
free(memory);
}

printf("mylist (size %lu) values:\n", array_list_length(mylist));
// Your STEP 1 printing loop will go here
for(int i = 0; i < array_list_length(mylist); i++) {
int* current = array_list_get_idx(mylist, i);
printf("%d\n", *current);
}

// free the array list which may leak some values until step 3
array_list_free(mylist);
Expand Down
4 changes: 2 additions & 2 deletions schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ title: Class Schedule
</ul>{:/}
</td>
<td markdown="span">
</td>
<a href="https://rosehulman-my.sharepoint.com/:p:/g/personal/noureddi_rose-hulman_edu/Ed5xz_-IYohJkY181epr6f4BGXWhlPajqlUpqVpbMKwBvg?e=bR0qAw"> Slides </a><br/>No activity today</td>
</tr>
<tr>
<td markdown="span">
Expand All @@ -53,7 +53,7 @@ title: Class Schedule
</ul>{:/}
</td>
<td markdown="span">
</td>
<a href="https://rosehulman-my.sharepoint.com/:p:/g/personal/noureddi_rose-hulman_edu/EcmqJLbNxRNPuUiRgvmIEBEBVUyjWk4wvoDA8wdlhZw-xg?e=c0WMVI"> Slides </a><br/><a href="{{ site.gh_activity_url }}/01_pointers"> Activity </a><br/><a href="https://moodle.rose-hulman.edu/mod/assign/view.php?id=2933248"> Activity Submission </a></td>
</tr>
<tr>
<td markdown="span" colspan="4"> [Linux Install]({{ site.baseurl }}/docs/01_linux_install) DUE Fri, Sep 03 2021 23:55 [Submission box](https://moodle.rose-hulman.edu/mod/quiz/view.php?id=2933257)</td></tr>
Expand Down

0 comments on commit a6315f8

Please sign in to comment.