Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 5099

C is a general-purpose computer programming language used for operating systems, games and other high performance work.

2
votes
I/O operations are not part of the C language in the sense that the names and signatures of the I/O functions are not magically know in your program. Instead you need a #include <stdio.h> to tell the … compiler about the names and signatures of the I/O functions. The implementation of those functions is in the standard library, which may or may not be written in C, although for the I/O functions …
answered Nov 15 '16 by Bart van Ingen Schenau
8
votes
As a program can only contain one function called main, it is actually very simple for the compiler to support the multiple signatures. In the call-sequence for main, the caller is made responsible f …
answered Mar 2 '13 by Bart van Ingen Schenau
11
votes
(which must be negative, usually it is -1). Note that EOF itself is not a character, but a signal that there are no more characters available. When storing the result from getchar() in c, there are … two possibilities. Either the type char can represent the value, in which case that is the value of c. Or the type char can not represent the value. In that case, it is not defined what will happen …
answered May 10 '13 by Bart van Ingen Schenau
2
votes
The problem with using an array (circular or not) as underlying data structure for a priority queue is that you must always copy elements around to create a hole where a new element should be inserted …
answered Jul 11 '14 by Bart van Ingen Schenau
2
votes
The register keyword in C can be used on any type of (local) variable and is only a hint to the compiler that you will be using that variable often, so the compiler should make accessing it as fast … as possible. As keeping a variable in a processor register is often the fastest way to access it again, that was the name that got chosen for this hint. Modern C compilers (less than about 20 years …
answered Jan 3 '14 by Bart van Ingen Schenau
4
votes
Yes, it is always the fault of a programmer. Either he messed up his own length calculations or he didn't properly sanitize the user input.
answered Jun 28 '17 by Bart van Ingen Schenau
10
votes
file). As there are non-repeatable elements that are commonly placed in header files, and those elements also belong in a header file, it has become automatic for C (and C++) programmers to put … include guards in their headers. In C++, it is even more common, as inline functions are used much more and class definitions have the same restriction as struct definitions that they can't be repeated. …
answered Nov 27 '15 by Bart van Ingen Schenau
2
votes
You seems to have misunderstood the C standard. Trying to modify a const-qualified variable is a constraint violation and must therefore result in a diagnostic message from the compiler. If you try … literally anything is possible. There is no implementation-defined behaviour within the context of const in the C standard. …
answered Jun 1 '13 by Bart van Ingen Schenau
26
votes
It is not always bad practice to do multiple things on one line, but it does have a higher risk of making the program appear more complicated that it needs to be. If I were pedantic, I could argue th …
answered Dec 13 '13 by Bart van Ingen Schenau
3
votes
It is valid C code to call malloc in main and free in foo, but it is not considered best practice. If allocation and deallocation are done in different, unrelated, functions, then it becomes that …
answered Jun 17 by Bart van Ingen Schenau
44
votes
Your reasoning goes wrong on several accounts: Segmentation faults are far from certain to occur. Using an uninitialized variable results in undefined behaviour. Segmentation faults are one way that …
answered Dec 26 '15 by Bart van Ingen Schenau
7
votes
Yes, the design of your Vector is 'wrong'. Such a vector is usually thought of as a resizeable array, with the associated expectation that, like an array, it directly contains the elements. Your req …
answered Jul 31 '13 by Bart van Ingen Schenau
1
vote
To answer the second question first, a C++-string is an instance of the class std::string that is part of the C++ standard library. A c-string (or c-style string, or NUL-terminated string) is a … sequence of characters that ends at the first '\0' (ASCII NUL) character. One important difference is that a std::string can contain embedded NUL characters within its contents, but a C-style string by …
answered Jan 4 '13 by Bart van Ingen Schenau
5
votes
In a high-level language, the compiler (or interpreter) remembers for every variable what type it is and where it is stored. The type of a variable determines its size and what operations can be perfo …
answered Apr 10 by Bart van Ingen Schenau
20
votes
The macro NULL is a null-pointer constant and has either an integer type or a pointer type. Using NULL to assign or initialize a non-pointer variable will lead to question marks from other programmer …
answered Feb 23 '16 by Bart van Ingen Schenau

15 30 50 per page