0

I have this code:

typedef struct {
	unsigned short a, b, c, d, e, f, g, h;
}est_;
est_ est[512];

I want to know if there is a way to access to a variable of est by this kind of thing:

var='a';
est[1].[var]=0;

Yes, it doesnt work but, there is a way to do such a thing?

Greetings!

3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by suricata
0

That could be close to making sense to me, but not quite. Are you trying to do something more like this?

est[var].a=0;

Or perhaps you could elaborate more about what you're trying to do.

0

Ok the question is that i need it inside a function . . .

int f_mov(char uno, char dos, int op, int pid)
{
	if(oneop(op) || op == O_NULL)
		return ERROR;
        /*Here, i want to do something like:
        est[pid].[uno]=est[pid].[dos];
        or something to avoid a lot of comparisions*/
	return OK;
}
0

I was thinking of the "frequency counter with an array" thing which almost seemed similar:

++freq['a'];

But with uno, dos, a, b, c, d, e, f, g, h -- I can't discern any sort of relationship.

0

Well, i think i will use a two dimension array :)

Thanks anyway!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.