|
-
Jun 29th, 2001, 05:05 AM
#1
Thread Starter
Monday Morning Lunatic
Code:
struct {
int iIndex;
char * szlabel;
char * szdesc;
}
This defines a structure. The next bit is just a statically-allocated array of these structures, initialised as you can see.
Code:
#define NUMLINES (int)(sizeof sysmetrics / sizeof sysmetrics [0])
This cryptic-looking line is actually quite simple. It divides the size in bytes of the ENTIRE array by the size of one of those elements, giving the number of items entered. It's a quicker way that counting them and hard-coding that number.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 29th, 2001, 06:32 PM
#2
PowerPoster
OK, here is a simple one
I saw this one too
static
{
int index;
char vari;
}
now you have closed the brakets and you define some like this
thevar[]
{
1, "great",
2, "then great"
};
why is:
thevar[0].index = 1
thevar[1].vari = "great"
and
thevar[1].index = 2
thevar[1].vari = "then great"
It is hard to explain it but that is something i am confised about beause you have just commas between two words and they are is certain variable.
-
Jun 29th, 2001, 06:47 PM
#3
Thread Starter
Monday Morning Lunatic
It's shorthand for defining a struct:
Code:
struct x {
int y;
bool z;
}
x theStruct = {56, false};
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|