4 ms·
Allowing arbitrary expressions allows self-documenting signatures: void concat_strs( int str1_len, const char str1[str1_len], int str2_len, c
by TazeTSchnitzel 4y ago
Allowing arbitrary expressions allows self-documenting signatures:
void concat_strs(
int str1_len,
const char str1[str1_len],
int str2_len,
const char str2[str2_len],
char out_str[str1_len + str2_len],
);
void manipulate_array(
array_dim dim,
int arr[dim.x][dim.y],
);
Supporting things like printf() was probably not specifically desired, but it would be difficult to define it in such a way that it accepts all reasonable expressions and doesn't accept any "unreasonable" ones.
- saagarjha 4y agoTip: if writing new functions that take things that are not strings, try to avoid C’s mistakes with strncpy and putting “str” in the name.
- TazeTSchnitzel 4y agoThose are strings! Null-terminated strings are not special.
- saagarjha 4y agoIt’s only a string of it comes from the null-terminated region of France. Otherwise, it’s just sparkling character arrays