Everyone ought to put that link in their signature. That and the one about gets().
Everyone ought to put that link in their signature. That and the one about gets().
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Like i said doesent matter. With a good compilier like gcc its really a mute point. But i do understand why its not needed.
In addiiton to the FAQ, you never need to typecast a void pointer when assigning one. Ever. There's no reason to do it, because the assignment is automatically promoted to whatever type you're assigning them to. Anything else is just a waste of keystrokes.
Quzah.
Hope is the first step on the road to disappointment.
> sizeof(char) is one, so there is no point in multiplying by it.
If you write
p = malloc ( n * sizeof *p );
then this always works and you never have to worry about 'remembering' to multiply by your object type.
The problem with optional things (like braces in single line if statements for example) is that sooner or later, it's not what you want and you don't even realise it until much later when you get that big "DOH" moment.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Of course, the OP seems to have gone away and taken their mysterious program with them, so I guess we'll never know.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.