Is there a good Valgrind substitute for Windows?

Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. I was looking into Valgrind to help improve my C coding/debugging when I discovered it is only for Linux – I have no other need or interest in moving … Read more

Valid, but worthless syntax in switch-case?

Through a little typo, I accidentally found this construct: int main(void) { char foo = ‘c’; switch(foo) { printf(“Cant Touch This\n”); // This line is Unreachable case ‘a’: printf(“A\n”); break; case ‘b’: printf(“B\n”); break; case ‘c’: printf(“C\n”); break; case ‘d’: printf(“D\n”); break; } return 0; } It seems that the printf at the top of … Read more

Return a `struct` from a function in C

Today I was teaching a couple of friends how to use C structs. One of them asked if you could return a struct from a function, to which I replied: “No! You’d return pointers to dynamically malloced structs instead.” Coming from someone who primarily does C++, I was expecting not be able to return structs … Read more

Why aren’t programs written in Assembly more often? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more