Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 12,726 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: sizeof() behaviour [Re: Wjbender] #456752
12/08/15 14:05
12/08/15 14:05
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
The second example is wrong wink
typedef has the syntax:
typedef oldType newName;
in your case, newName is 'objects2', oldType is
Code:
struct objects2 {
    int a[1024];
}



so objects2 is actually a type name and not an object. you must declare
Code:
objects2 obj3;

to get an acutal object of type objects2


Visit my site: www.masterq32.de
Re: sizeof() behaviour [Re: Kartoffel] #456753
12/08/15 14:29
12/08/15 14:29
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
it is in relation to this question



Originally Posted By: Wjbender
rest assured.

Code:
obj pluto;
printf ("%I",(int)sizeof (pluto));



Originally Posted By: Kartoffel
Thanks, I'm aware of this, but shouldn't it work the way I've written it?
In c++ it sure does and I'm pretty sure that it should work the same in standard c.

...well, this basically means that all of my memory allocations for user defined structs that I ever used are completely wrong, at least in lite-c.


where :

Code:
typedef struct
{
   int stuff [1024];
}obj;




Compulsive compiler
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1