There is nothing wrong with making a string in c like this.
typedef char[100] string;
What if you need a string big enough to hold your mom's weight?
>>56360484
Then it would need to be dynamically allocated
>>56360382
Well, except for the syntax error of course
>>56360382
test_typedef.c:13:16: error: expected identifier or ‘(’ before ‘[’ token
typedef char [100] string;
gcc thinks otherwise.
>>56360382
What the fuck is that?
>>56360659
>>56360889
Well maybe i typed it wrong but you know what i mean.
>>56361345
Do we?
>>56360382
But why?
>>56361397
const int STRING_SIZE = 10; typedef char string[STRING_SIZE];
>>56360382
There is everything wrong when working with strings in C. It is so fucking easy to make a fail when working with strings in C.
Substring, length, concentation, startswith, endswith, god sake split or regex, toLower, toUpper, trim, read unknown length of text from user. Just sucks. Or when trying to parse date, number or something else. Pure cancer.
So fucking bad. And oh god, the functions names, if you are so lucky and doesn't need to re-implement wheel for the 99th time again, good luck understanding the cryptic name of arguments and then it shits itself when porting to "just works" Windows, which have same functions, but slightly more fucked up names.