22
setleaf
7y

When a professor says, "strings are an array of characters" and you proceed to post a question on stack overflow containing the phrase, "strings are an array of characters" and get a healthy dose of knowledge about what strings actually are....

I'm paying for this education?

Comments
  • 9
    Not sure what you found out, but strings actually are arrays of characters (in most languages). What did you find out to think otherwise ?
  • 1
    @thecritic Well quite a few people replied saying strings were actually very complex classes and not simply arrays of characters. The language was C++ by the way.
  • 14
    Pure C strings are actually arrays of characters "char *" (a pointer to a character in memory). They are stored in contiguous memory so that you can basically jump from character to character until the null terminator (last character is '\0') which esentially forms a string. C++ added string utilities, but at the very core I am very sure that they are represented in very much the same way. C++ just aimed to make developers' lives easier by providing that whole string library.
  • 2
    @thecritic Interesting! I wonder how they implement it as an array of characters in C++ since arrays can't be of variable length, but you can add characters onto a string changing the size of the array?
  • 7
    Arrays in C/C++ can actually have variable length. You can actually allocate memory on the heap and mess around with that memory how you like, that's one beautiful aspect of the language. I think you need to get your feet wet a little more before you judge your teachers/professors.
  • 1
    @thecritic I wasn't aware of the fact you could have variable length arrays.

    To give the full story, I emailed my professor with a thorough explanation of a problem and asked for guidance. He responded with he wasn't sure what the problem was, so I posted the exact same thing in stack overflow and had multiple people tell me that something he had told us in class wasn't correct, WHILE actually giving me an in-depth explanation and answer to my issue....for free....hence my rant.
  • 4
    @setleaf if your professor said that and he replied with "I don't know that" instead of some B's, you're in good hands
  • 3
    @setleaf It's okay, it just hurts my heart a little bit sometimes when people post misleading information. No hard feelings, just wanted to set the record straight on the strings that's all.
  • 1
    Meditation exercise:

    Everything is an Array ^_^
  • 1
    @metaory yes disk are basicly array if bit, pointer, memory, or something?
    afaik
  • 0
  • 0
    Everything can be a stream, that's the Rx mantra.
Add Comment