i's memory is allocated automatically on the stack and gets freed automatically when you leave whatever routine you're in - be it another function or main.
Anything allocated memory with malloc()...
Type: Posts; User: wiiire
i's memory is allocated automatically on the stack and gets freed automatically when you leave whatever routine you're in - be it another function or main.
Anything allocated memory with malloc()...
All the stuff below this :
return 0;
in your code needs to go into a new function called playCraps.
You see, if you put code beneath your return statement, it's never going to get executed...
Ahhh I see ! Thank you for that explaination... I couldn't work out why it would be any different !
I was hoping I could avoid making it static and passing a pointer, but I suppose not. At least I...
hiiiiii!
I'm going slightly insane here! This is the declaration for SDL thread creation:
SDL_Thread *SDL_CreateThread( int (*fn)(void *), void *data );
Based on this and the example I...
hmm, what was the full error?
I believe in C, if you're calling a function before you define it, you need to declare it first (your declaration for fcfs looks like it's in the middle of the...
What is that, exactly? I thought before it was this :
You just need to flush buffers to stop that... with flush...
Could you be more precise?
Yeah, I think that's the point :)
I find web definitions help make sense of this stuff...
Associate :- Make a logical or causal connection; "I cannot connect these two pieces of evidence in my mind"; "colligate these facts"; "I...
I haven't used Valgrind yet (only recently switched to this craaaaaazy OS and not had the need for it so far), but is it no help in plugging the leaks you found?
That would totally be my first...
If you use the flush manipulator on the stream, it will flush it to the file.
cout << something << flush; // flush to cout's stream (default stdout)
csis << something << flush; // flush...
You should find your swapfile usage drops to 0 (or close to it).
Linux utilises all available RAM eventually and gives the appearance of not freeing it after processes have ended (really it's...
Ks add up to megabytes!! :) :)
Not precisely sure what you're doing, but..
if(newTime > MAX_VALUE)
newTime = newtime - MAX VALUE;
Do you mean :
if(newTime > MAX_VALUE)
Oh yeah sorry, that's C++ :/
(edit :- or really old, crappy C compilers like the one we have here!)
You're probably finding your code is erroring here :
if(!(marks = malloc(2*count*sizeof(int))))
You need to cast the result to the pointer type.
ie.
marks = (int*) malloc(...)
At a first glance, it looks like you've coded your find() routine to search down the list to the depth level equalling the length of the string passed :
--len;
if(len != 0)
{
...
I would say C expressions are state-less.
In an imperative language, you could argue that an expression results in a value.
Although the value of such expressions is relatively questionable...
if(fork() == 0)
fork makes me smile :D
This is excellent for anyone trying to learn too :
http://www.cs.mtu.edu/~shene/NSF-3/e-Book/index.html
I've found its explainations better than most so far.
Its illustrious memory handling :D
I've decided to write a C library to handle my sockets.
I have a few reasons for deciding this :
1) boost, though undoubtedly cool looking, seems to provide additional abstraction which I...
Yeah gotta love C# for this particular ambiguity :rolleyes: :rolleyes:
What errors are you getting?
A short list for now :-
* you have several inifinite loops :
if(k=='1')
{
while(1)
{
The whole point of being set work is that they learn from attempting to do it (as opposed to passively just listening to or reading rules).
Kinda how most decent programmers learn ;)
We had a...
for(int i=0; i=used; ++i)
{
which it never will unless used is 0...
;)