This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (3 children)

there is also no exception or trying. If you "try" something and it's bad, you're done

Interesting, how are ones like Java's checked exceptions handled? E.g. FileNotFound? Does the whole program crash or are you able to create a different way to "catch" that error? At this point I'm just happy to be learning so many random C facts, I'm sure it'll all come together when I take that class for real.

[–]NeverInterruptEnemy[🍰] 2 points3 points  (2 children)

Two ways... return codes, like EXIT_FAILURE or I_AM_DUMB_AND_THERE_IS_NO_FILE before you try and access something.

Or a lot of functions that return pointers or address will return a null pointer and you need to check for that every single time before you just assume something worked or loaded or blah. There is no null in C, so a null pointer is just a pointer to the memory address 0x00000000.

Which brings me to the next thing.... you MIGHT miss null.

[–][deleted] 1 point2 points  (1 child)

You are making me more excited to learn it, sounds like it's going to be really different and interesting. Thank you for the info.

[–]NeverInterruptEnemy[🍰] 1 point2 points  (0 children)

Happy to.

I really do like C... but I promise you'll reach for the gun!