Topic List | Page List: 1 |
---|---|
Topic | Ugh dealing with "strings" in C is such a pain. |
DevsBro 10/25/18 8:03:13 AM #9: | Tyranthraxus posted... C doesn't really have strings the way other languages do. They are char arrays. And yes they all need to be null terminated. I think some compilers will do it for you but C generally assumes you know what you're doing and will let you make a non null terminated string of you really want to. Yeah I just don't do a lot of C so I didn't think about it and malloc'd and copied the actual length instead of length + 1. A char array that isn't null terminated is actually valid and sensible in lots of cases, considering it's also the one-byte integer type. Or maybe you really do want an array of characters. Maybe it's a fake word generator or something and you want to keep track of which letters are vowels, frigatives, liquids, etc. --- 53 LIII 0b110101 p16 0x35 ... Copied to Clipboard! |
Topic List | Page List: 1 |