I would recommend the following code. It works whether the list is empty or not. The only drawback is that it appends new items to the font of the list. It is clean and easy and if order does not matter it is the preferred method.
static head = NULL ;
void addToFront( struct node *new ){...
Dennis,
You are right. s is an arrary of const chars, my mistake. Since arrays and pointer are so similar in C I sometimes use them synonomously.
Now to your question.
In your second example s is an array so
s = foo ;
is illegal.
In your third example s is a pointer so
[code]s = foo ...
Dennis,
There are four places that variables are stored.
1) The data segment (globals, static, const)
2) The stack (local variables)
3) The heap (malloc)
4) Processor registers (compiler-chosen local variables)
I believe that a literal string will always be in the data segment, i.e. the actual...
Denniscpp,
A pointer is an address which references memory (usually virtual memory). Bytes in memory are organized in a linear fashion by their addresses starting with byte 0 (address 0) and ending with byte N (N is very large). So an address is an unsigned integer. If the address is '4'...
Do you have more than one name server in your /etc/resolv.conf. If you do, they are searched in the order in which they are in the file. If your first listed nameserver is offline, then you will have to wait for a time out before the next one is tried.
Mark.
keenanbr,
Without question, vi is the best text editor ever invented!!
There are several ports of vi to Windows. I highly recommend vim (VI Improved). You can get it at:
http://vim.sourceforge.net/
It supports all of the familiar vi and ex commands you are used to and more.
It also gives...
Blueruby,
Just a couple of points of clarification.
1) Shared memory will be available to forked child processes. If you are sharing with only child processes, create and attach before the fork and everything will be automatic. In this case you can use the IPC_PRIVATE key to create the...
Fabien,
Probably the best example that I can think of is sigaction in UNIX. A sigaction is a structure which refernces actions to tasks when a signal is raised. The fields of this structure specify various actions to take, depending on which of them are non-zero. In linux the structure look...
Any modern computer OS will have separate stacks (and address spaces) for each process. The kernel should execute in its own address space and run in processor supervisor/privileged mode. Additionally you should implement your design using virtual memory, allowing any process's stack (or heap)...
Fabien,
memset() writes memory that has been allocated. It is sometimes used to initialize memory for a variety of purposes. It is sometimes used to clear a structure which is passed by reference for the purposes of returning data to the caller (for example, see shmctl(), semctl(), etc)...
fabien,
Use shmget() to create a shared memory segment.
Use shmat() to get a pointer to the shared memory segment.
The details are in the man pages.
Mark
Are you a programmer in another language? There is a big difference between learning another language and learning yor first language, because most of learning your first language is learning how to program (i.e. variables, procedures, looping, compiling, etc.).
Hello,
The problem is that infosQueue does not point to real memory.
try:
struct msqid_ds infosQueue; /* Note the missing '*' */
msgctl(IdQueue,IPC_STAT, &infosQueue); /* Note the inserted '&' */
Brudnakm
nop stands for no-op. This causes the CPU to idle for one clock cycle.
cop will give you a ticket if you go too fast. :-) Seriously, I am not familiar with the cop instruction.
Brudnakm
I recommend that you use a runge-kutta 4th order. It is very standard and can be found in a numerical methods book. It can be implemented in less than ten lines of code.
Brudnakm
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.