Parsing is the process of finding out the structure of some source text. For example:
int foo(int a, int b) {
return a+b-42;
}
To a human, this looks nice and structured. However,...
Type: Posts; User: hairyian
Parsing is the process of finding out the structure of some source text. For example:
int foo(int a, int b) {
return a+b-42;
}
To a human, this looks nice and structured. However,...
Even worse is the fact that the output is implimentation dependent, and that the putchar line invokes undefined behaviour!
I'm glad I didn't learn C from someone who hands out such code.
Ian...
Just on a side note, there's another way of doing the same thing:
There's been a few times when I've used a library which required the use of the flat[x+w*y] form but where I've wanted the...
In C, you can return any int value you like from main. However, the only ones which have defined behaviour on all operating systems are:
0,
EXIT_SUCCESS, and
EXIT_FAILURE.
(Those two macros...
feof() doesn't do what you think it does... or in fact, what anonytmous thinks it does.
feof() only tells you EOF has occured only when some other stdio function (fscanf in your case) has already...
For trang:
The way you're using scanf is dangerous. If the input is more than 1 character long, then you'll overwrite the array into which you're reading data. You need to specify the length of the...
In one sense, you are right: the IMPLEMENTATION needs to worry about these things.
The definition of the C standard does not require that kind of memory model at all - it is a very very flexible...
sscanf is slower than doing a direct conversion because it's a more generic tool. It may be 2 or 3 times slower (or more, or less), depending on your implementation. Profile the code. If you meet the...
Hmmm, the most challenging thing to program......
Once you get to a certain point there is no such thing as a challenging program. The actual programming is no longer hard, no matter what the...
Without seeing the code, it's very difficult to say what's wrong. Even so, here's a guess:
You have declared a function MyReadProc but not defined it... :)
In other words, you have something...
There's a simple way you can tell whether or not you should be using malloc.
There are only two ways you can have memory allocated: either through malloc and friends, or by declaring a variable....
Reading the environmental limits from C99, a conforming compiler must allow at least 127 levels of nested blocks in order to be conforming. This may be larger than that required for C90.
127...
I'd just like to point out that the way programs loaded and executed posted upthread is not the only way, and in the modern age there are vast differences.
The entry point of a program does not...
Size and speed are not mutually exclusive. I've seen many things which 'should' have been faster by conventional rules when unrolled which, in practice, were not.
On processors with branch...
That function doesn't free the contents of the node, just the memory allocated to the node structure itself.
Either:
a) free the contents of node in the function
or
b) free the contents...
Note of course that if the computer is in /any/ graphics mode or any other text mode this code won't work. It also doesn't work if I have specified a different page to be shown than the first one,...
Option 1
#include <conio.h>
... code ...
clrscr();
... more code...
advantages:
clears the screen...
I'd expect so. Array identifies when used in an expression (except of course as the destination of an assignment) evaluate to a pointer to the first element of the array.
Ian Woods
The function itself isn't a pointer: it just returns one.
The specification for strcpy is that it copies the contents of one string into another and returns the pointer to the first character in...
That wasn't quite what I was refering to.
If you go and take a look as MSs website and the promo text for Visual Studio .NET it's quite apparent that they don't even say it compiles C++ /at all/...
what's the problem with gets()?
It's a bug and a security hole in many situations. gets() doesn't accept a length and so will keep writing off the end of the allocated space it's been told to...
Shame that there are a few errors in the C reference card. :) Not bad, but a few elementary mistakes. (Case in point: C does not define the sizes of integer types as exact numbers of bits as is...
How's about:
o variable length arrays
o a whole new set of type generic maths functions
o a new meaning to word 'static' (with a famous quote)
o a number of new string processing functions...
And why would a technician want to meet system requirements? By definition, anything which can be implemented in any programming language on a given platform can be implemented in machine code on...
Importantly, VC++ isn't even a C++* compiler. For an interesting exercise... can anyone find any documentation on Microsofts site which says that they're VC++.Net offering actually compiles C++*?
...