python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Ternary Operator (?:) based assignment avoids type check in C
I am not able to understand why the compiler doesn't warn when assigning incompatible pointers through (?:) but does warn on direct assignment.
Compiler warns in this case:
test.c: In function ‘main’...
Rajnesh
Votes: 0
Answers: 2
When I write my own strchr function, there is a part in the return step that I don't understand
I'm trying to write my own strchr function for school, but there is something I don't understand.
char *ft_strchr(const char *s, int c)
{
size_t i;
size_t len;
i = -1;
len = ft_s...

user13101974
Votes: 0
Answers: 1
Why can void pointers be subtracted but not added?
Why does
printf("%ld\n", (void *)0 - (void *)0);
compile, but
printf("%ld\n", (void *)0 + (void *)0);
does not?

Sapphire_Brick
Votes: 0
Answers: 2
Why can `qsort` be called with a compare function with the wrong signature and compile has no warnings
I was working on consolidating a code base (moving a qsort compar function to a new header /library so that it could be shared without being copy/pasta) and noticed something strange in the process.
H...
Yeow_Meng
Votes: 0
Answers: 1