#cmsc21 module4
Explore tagged Tumblr posts
cmsc21patricia ยท 4 years ago
Text
CMSC 21: Module 4
Module 4 is a lot of fun for me. Arrays and strings in general are the focus of this module. Arrays in C are similar to lists in Python, which was covered last year, making learning about arrays easier. The same is true for strings. However, pointers are also used in this case. I'm not comfortable with pointers yet, so that part is difficult for me. Moving on, I believe I performed admirably in the exercise. I've already done palindrome and anagram checker programs in Python before, so I just need to tweak a few things in my code to make it work on C. Overall, I had a lot of fun with this module.
To answer the questions, an array is a collection of several values, but a variable can only hold one value at a time, which is why arrays are beneficial when there is a need to use numerous variables of the same type. In arrays, gaining access to an element is as simple as using the index number. They are also used to implement many other data structures, such as lists and strings, which are essential in coding. Because array bucket values are stored in contiguous memory regions, pointer arithmetic may be used to traverse over them, and some are allocated in row-major order. When you build an array, the type of items and size are fixed and determined. Memory is allocated immediately after the array is constructed, and it is empty until the values are assigned.
0 notes