Having said that, I realised that you wrote "not all the boxes are mandatory". Does this mean that all the root box names are known in advance? If so, then maybe you're overthinking it: a struct of...
Type: Posts; User: laserlight
Having said that, I realised that you wrote "not all the boxes are mandatory". Does this mean that all the root box names are known in advance? If so, then maybe you're overthinking it: a struct of...
Basically, you want to map root box names to struct objects. As per the hint from Perl's hash variables, one way is to hash these names as strings so that they become indices in some kind of hash...
I suggest that you learn to use the standard library and perhaps other common utility libraries before you go along the path of the obscure. After you learn to use them, learn to implement them.
I...
It sounds like you just want to do something like what strcmp does to produce a yes/no result concerning the question of whether the strings are equal. If so, then it could be as simple as:
const...
* looks at votes *
The tribe has spoken.
Your strategy of using char and character constants in a switch should be absolutely portable for any standard conforming C implementation since the C standard explicitly mandates that those...
The key is to understand why do we return a pointer from the ADD function in the first place. The answer to that is that we want to update the head pointer from the caller, and we cannot do that...
Perhaps it would be easier if you provided your implementation of the recursive approach too, as well as your test input data that demonstrates the different result.
Since you're using MinGW, the issue here might be that the Visual C runtime is used, or something like that. It is why instead of the standard %lld you may have to use %I64d or something like that to...
The typical approach is to provide an opaque pointer. But this means that all the functions that make up the interface of your library must either accept a pointer parameter or return a pointer that...
Yes.
Yes
Yes, but that's a self-referential tautology and hence doesn't really mean anything useful. What you probably meant to say is that you think that the next pointer of the first node...
The OP wrote it right there in post #1:
This is typically used when you want to have a constant time append operation for the linked list (in addition to constant time prepend).
Yes.
Yes.
I think you're talking about the next pointer of the first node. Since the first node was only just created, there is no second node, hence the next pointer of the first node must...
spvar is a pointer to struct point. Therefore, *spvar is a struct point. So what you're doing here:
printf( "%d ", *spvar );
is trying to print a struct point object as if it were an integer. It...
Unfortunately, you cannot assign to an array itself. However, you can initialise them, and in this case it means initialising the struct of which the array is a member:
struct point svar = {1, 2,...
Yeah, I hold that opinion too, as my objection to object pointer typedefs has to do with pointer notation such as dereferencing the pointer then becoming surprising. For opaque pointers, neither any...
Unfortunately, since new does not necessarily have a size of sizeof(struct point) bytes unless you've checked its declaration to confirm, it isn't as self-documenting as using sizeof(*new), in which...
For #2, I'd guess that you have mixed up the address-of operator with the bitwise and operator. They both use the & symbol but with very different syntax and semantics.
Why don't you give it a try? In the code you showed, you didn't even have a variable for the count. Put in a bit more effort.
One approach is to keep track of the current value with a variable. Another approach is to compare the value of the current element with the value of the previous element.
john.c introduced a struct type in order to construct a linked list, i.e., struct N represents a linked list node. This way, you can store the values in a linked list and thereby loop over the linked...
You might find it more insightful and more useful for learning, both theoretical and applied, to implement qsort yourself, using a different name but with the same parameter list and return type....
I suggest a function prototype like this:
char *reverseString4(const char *str);
To implement roughly the same thing as the C++ code, you would:
1. Call strlen to find out the length of str....
Why do your nodes have a member named f that appears to function as a "free flag"?
I would expect that the callback function would set this flag (or not) when called, thus indicating that the node...
Yes, you don't know what you're doing with your program. If you disagree, read your code from decades ago and you'll realise that it is true :p