Sorry for wasting your hard work >_<.
But yeah i do it like
Because to me putting the * beside int while making the variables is to remind me that when initializingCode:int* a, * b, * c; *b = 3 *c = 34
That at this state a is the address, and not the pointed to value. Otherwise i might confuse my self and think, hey there is an * beside the variable, that means the value pointed by, thus im gonna put what i want the pointed to value to be.Code:int* a = address
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
I do use bookmarks >_> It's just a lot of my tabs are google searches that i think of at the moment, and say to myself i'll look at it later, i usually remember, but sometimes i forget.
And the other tabs are devoted to thinks i check on a daily basis, like one manga, and mpgh.
edit: Haha i was wrong, i only have 20 tabs on one, and 33 on the other.
Nice writeup , however....sample a does work.
Also c++ does support specific pointer types (like void pointers etc)
But that's a slight detailCode:typedef struct MyBUFFER { void* pBuffer; unsigned long ulSize; } MyBUFFER, *PMyBUFFER; void DoSomething() { ..do something interesting MyBuffer* pBuff2; PMyBuffer pBuff; //Basically the same things as writing: MyBuffer* pBuff2; //*pBuff would be the same as **pBuff2 ..do some other stuff }Put the */& where ever makes most sense for you and don't over complicate things so that months from now if you need to work on the code you still remember what the heck you did.
![]()
Wow. Im confused.
right here:
did you just declare a pointer variable PMyBUFFER ?Code:MyBUFFER, *PMyBUFFER;
what's with the comma?
So far I'm just getting into typedef in my book and I don't know why it exists. unless if you just feel the need to name something something else o_O?
BTW: if im right then this would declare PMyBUFFER too:
right?Code:struct, PMyBUFFER;
On second thought Im just gonna shut-up xD. I don't even know what a void pointer is. I've never used void in a type only in functions. Guess I'll get to it eventually. :P
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
You are also confusing me, but i think a little less then Why06. The *PMyBUFFER; , means a pointer to the type you just created, MyBuffer, correct? What confuses me, is how a pointer to a custom type would work, guess i can just try it out and see what happens
Wait isn't PMyBuffer supposed to be a variable of the struct MyBuffer? How are you using the variable like it is a type, and creating more variables with it 0.0? Sorry that i know so little.
Wait ignore that last paragraph, forgot the typedef. To be honest i'm not that steady with understanding of typedef but i think i understand that part. Really just the pointer to a custom type that i don't understand....
Mybuffer* pbuff = new Mybuffer;
Ok, nevermind just completely ignore me, Please and thank you.
Last edited by zeco; 09-03-2009 at 10:42 PM.
Yeah i can be really confused/confusing sometimes, But i think i get it all now. By the way, what is the point of structs? Haven't classes basically superseded them? To my knowledge the only difference between a struct and a class, is the default access specifier (class is private, struct is public.)
Classes rule! Except in school.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower