Maybe. I started when I was about 14. But I couldn't stay interested enough in it at the time and didn't return to programming until a few years later.
I've seen it in the bookstores, but haven't...
Type: Posts; User: Narf
Maybe. I started when I was about 14. But I couldn't stay interested enough in it at the time and didn't return to programming until a few years later.
I've seen it in the bookstores, but haven't...
Well, you have to blame somebody for the ills of the world. It's easier to complain than to fix something.
I'm dying to know how an invalid declaration prompted a question about memory layout.
anonytmouse didn't make a typo. He really did mean sscanf() as opposed to scanf(). You can see the differences here. scanf() reads from a stream but sscanf() reads from a string.
So use a number:
int num;
if (scanf("%d", &num) == 1 && num >= 0 && num <= 90)
printf("%d is valid\n", num);
That's not gonna happen. Sorry, but this reeks of homework and if we gave you the code then you wouldn't learn anything. But here's a hint: Reverse each word, then reverse the whole string. You can...
Well naturally it's not portable. Presumably bhuwan already knows that it works on his system, or he'll be back shortly to ask why it doesn't work. :)
It's pretty straightforward. You cast the address--as a literal value--to a pointer of suitable type for how you're going to use it. The pointer then points to that address and you can use it just...
Something like this:
volatile unsigned char *addr = (unsigned char *)0x80000000;
The problem isn't about type. cSM is the right type, but it points to memory that you can't modify. To fix the problem you need to copy the string into memory that you own so that strcpy() can safely...
cSM is set to a string literal. strtok modifies the string you pass to it, and you can't safely modify a string literal because it could be in read-only memory.
Pre-C99 code would do it like this:
#include <stdio.h>
#include <stdlib.h>
struct test {
int a[1];
};
What kind of games? You can write a game after about 30 minutes of practice with C++. But if you're talking about what most people think of as games, you need to know more than just language features...
If you store the data the right way, efficient search becomes a non-issue.
Probably not, but you're not explaining the problem to the point where I can fully understand what you're doing. I don't...
If you're not sure what it does, you really shouldn't be using it. ;)
Your best bet is to avoid passing 0 to malloc() in the first place. It's an easy case to test for, or you can write your code...
Can you store extra information in the data structure or create a helper data structure? If I understand your problem then you can just store the partition number for each point with that point and...
Well I would, if there were something to laugh at. By the way, I have a way to call malloc() that's easier to get right:
char*compare=(char*)malloc(sizeof(char*)*20);...
Your compare variable is a pointer, but ReadCatalogue expects a pointer to a pointer. Change the call to this and see how it works:
ReadCatalogue(myfile,*choice,&compare);
You call the default constructor explicitly, then pass it as a return value where the copy constructor is called implicitly behind the scenes. Just because a compiler might implement return value...
None that are worth the money they ask you for it.
The one that I've colored red for you:
class C
{
public:
explicit C() {};
explicit C(const C& c) {};
~C() {};
};
A constructor only needs to be qualified as explicit if it takes a single argument and you don't want implicit conversions to be made. You want implicit conversions with the copy constructor, or...
Which is irrelevant with inclusion guards because you only need one unique identifier per header. In general I agree that defined() is more flexible, but for inclusion guards I don't see the need.
...
And the actual standard says:
Where the footnote 253 is exceptionally clear:
I didn't comment it out, I just commented that it wasn't a good idea:
// memset() probably isn't a good idea
memset(tmp->ptr, 0, sizeof *tmp->ptr);
If I knew the declaration of DFNCOL then I...