[C][help request] variable with typestruct - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Programming with C++ (https://www.supportforums.net/forumdisplay.php?fid=20) +---- Thread: [C][help request] variable with typestruct (/showthread.php?tid=774) |
[C][help request] variable with typestruct - suricata - 10-08-2009 I have this code: Code: typedef struct { I want to know if there is a way to access to a variable of est by this kind of thing: Code: var='a'; Yes, it doesnt work but, there is a way to do such a thing? Greetings! RE: [C][help request] variable with typestruct - g4143 - 10-08-2009 Do you mean something like this? Code: #include <stdio.h> The other thing your trying to do is illegal. var='a'; est[1].[var]=0; The value 'a' has no meaning in address resolution. Its just the value 0x61 hex...G4143 If this is where your C++ tutorial or book is taking you then get rid of them because your way off with this one... RE: [C][help request] variable with typestruct - charnet3d - 10-08-2009 You can't do it that way. But you can do something about it so that it behaves like what you imagined. if you can explain to me what you need to do in more details I may be able to help you.. RE: [C][help request] variable with typestruct - suricata - 10-08-2009 The question was: Code: int f_mov(char uno, char dos, int op, int pid) But i solved it with a two dimension array Thanks anyway for the replies! RE: [C][help request] variable with typestruct - g4143 - 10-08-2009 (10-08-2009, 07:24 PM)charnet3d Wrote: You can't do it that way. But you can do something about it so that it behaves like what you imagined. You don't know what he wants but you can imagine a way to make it work in C++...This makes all kinds of sense. I can just see the answer...Its supposed to do something like the thing you want but its waiting for you to define what it is supposed to be....G4143 RE: [C][help request] variable with typestruct - charnet3d - 10-09-2009 suricata Wrote:But i solved it with a two dimension array yeh cool then, because all the variables inside the struct are of the same type, doing it that way is the right thing |