Do I cast the result of malloc?
In this question, someone suggested in a comment that I should not cast the result of malloc. i.e., I should do this: int … Read more
In this question, someone suggested in a comment that I should not cast the result of malloc. i.e., I should do this: int … Read more
Optimizing SQLite is tricky. Bulk-insert performance of a C application can vary from 85 inserts per second to over 96,000 inserts per second! … Read more
After reading Hidden Features and Dark Corners of C++/STL on comp.lang.c++.moderated, I was completely surprised that the following snippet compiled and worked in … Read more
I have the following program: As I read in the C book, the author says that scanf() left a newline character in the buffer, therefore, … Read more
When I try to compile C code that uses the gets() function with GCC, I get this warning: (.text+0x34): warning: the `gets’ function is dangerous … Read more
Best Answer C has the concept of undefined behavior, i.e. some language constructs are syntactically valid but you can’t predict the behavior when … Read more
What is wrong with using feof() to control a read loop? For example: Best Answer while(!feof) is wrong because it tests for something that is irrelevant … Read more
What is undefined behavior (UB) in C and C++? What about unspecified behavior and implementation-defined behavior? and What is the difference between them? Best Answer Undefined behavior is one … Read more
TL;DR int *sieve = (int *) malloc(sizeof(int) * length); Has two problems in result of malloc. The cast and that you’re using the … Read more