cool, thanks. I think I was mis-understanding the 'luckiness' of having the array pointer values always showing up as nil, when it's just as you say that early in a small program it's just by...
Type: Posts; User: dougieb
cool, thanks. I think I was mis-understanding the 'luckiness' of having the array pointer values always showing up as nil, when it's just as you say that early in a small program it's just by...
so immediately after line 41 (and for any non-static variables), the correct thing to do is loop through the array setting each index value to nil ?
Yes, I understand that. But my_array appears to be initialised to nil in every array index position, rather than random/garbage data. How did that happen?
Hi,
I am trying to understand how to manage arrays of pointers to structs. I built up some (verbose) simple code to build a struct containing an array of pointers to other structs. The main...
For anyone else thinking of similar things, the K&R C book (Ansi C edition) has a pretty good example (page 145 in my copy) to get started.
This hashing function seems to produce a very equal...
Hi,
My scenario is similar to shopkeepers and customers. Shopkeepers open a long running tcp connection to the server, and have interactions with customers who have short lived tcp connections. ...
yep, that's it. makes sense when you understand it :-)
thanks again..
good tutorial Andrew. Although it makes sense, I'd never really considered that 'a pointer' is just variable that has it's own address as well. so &ptr is giving you a pointer to a pointer...
hmm.. "especially you should not simply copy pointers around... " is that what 'hostlist[0].name = hp->name' is doing ? is that copying the pointer in hp->name, rather than (as I wanted) copying...
Hi,
thanks. yeah that extra ampersand was just left there while playing around with the first statement trying different options to print the address in hostlist[0].name.
I get that...
hey,
getting a bit confused with pointers, structs and pointers within structs. I'm trying to use gethostbyname to get resolve a hostname to an ip, which I will then store in the host struct. ...
just checked the http 1.1 spec, and the client can request the connection state in the header:
Connection: Keep-Alive
Have a look at 10.9.1 in the http 1.1 spec.
I think you need to be looking at the KeepAlive settings. I only know Apache (not IIS, BBC is a M$ shop right?), and you can switch this off entirely at the server end.
I'm not not sure how...
that's great guys, makes sense.
thanks,
ok, so just to clarify (so I never need ask again!).
if the program is interrupted, the OS will free up any memory that has been allocated.
if the program exits (finishes, crashes), the OS will...
and the OS does that because it is an interrupt?
whereas if the program completes (and I don't free memory), the OS won't free it for me? thus leading to a memory leak?
PS. actually thinking...
this is excellent. I just set out to find the difference between malloc and declaring variables (and why you don't free variables), and here is it after a short search. I didn't realise the...