55

C is a cool programming language where if you want to return a string from a function you have to set up an entire physical-universe human social system for adjudicating who is responsible for freeing it "In order to create a C string, you must first create civilization"

"In order to create a C string, you must first create civilization"

Comments
  • 5
    That is why you use 0x[0-F] and shit like that
  • 10
    Just pass char* param to the func 👌🏼
  • 1
    Cant you have char[] as a func output?
  • 7
    @Gregozor2121 no array return in C
  • 2
    Why you want to "return" a string? You can declare an array (char[]), pass the memory address to the function and work with it.
  • 2
    @Gregozor2121 arrays decay to pointers when passed to or from a function.
  • 1
    Strings ARE a kind of civilization, man. If you don't feel like that in the other languages, it's because someone hide the complexity from you: call it "Atlantis", lol
  • 4
    Real problem is when strings are not null terminated.
  • 0
    @neriald then the program already has a bug. Or, you could define structs with Pascal like strings, but that runs into different problems - e.g. you can never hand around the rest of the string for further parsing.
  • 1
    These kind of things are why i stopped using stopped using C ^^
Add Comment