Click here to Skip to main content
15,923,120 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Switch with CString, char * and char[] Pin
Christian Graus23-Jul-02 22:26
protectorChristian Graus23-Jul-02 22:26 
GeneralRe: Switch with CString, char * and char[] Pin
Tomasz Sowinski24-Jul-02 0:57
Tomasz Sowinski24-Jul-02 0:57 
GeneralWindows Hooks Pin
BishGada23-Jul-02 22:11
BishGada23-Jul-02 22:11 
GeneralRe: Windows Hooks Pin
Don Miguel23-Jul-02 23:03
Don Miguel23-Jul-02 23:03 
GeneralRe: Windows Hooks Pin
Daniel Lohmann23-Jul-02 23:07
Daniel Lohmann23-Jul-02 23:07 
GeneralRe: Windows Hooks Pin
Anonymous23-Jul-02 23:59
Anonymous23-Jul-02 23:59 
GeneralRe: Windows Hooks Pin
Daniel Lohmann24-Jul-02 3:36
Daniel Lohmann24-Jul-02 3:36 
Generalsize of struct Pin
rsasalm_23-Jul-02 22:07
rsasalm_23-Jul-02 22:07 
Hi all,

I have a basic question regarding size of struct.
I have following code:

struct MyStruct
{
int PortAddress;
char onmask;
char offmask;
int *PortData;
};

void main(void)
{
struct MyStruct m_struct;
int* pInt;

printf("size of char = %d\n",sizeof(char));
printf("size of int = %d\n",sizeof(int));
printf("size of int Pointer= %d\n",sizeof(pInt));
printf("size of MyStruct= %d\n",sizeof(m_struct));
}

Out put looks like:
size of char = 1
size of int = 4
size of int Pointer = 4
size of MyStruct= 12

Now my question is why I get the size of Mystruct = 12 instead of 10 (4 + 1 +1 + 4) ?

thanks for help

regards
/rsasalm

GeneralRe: size of struct Pin
NormDroid23-Jul-02 22:20
professionalNormDroid23-Jul-02 22:20 
GeneralOnCmdMsg Pin
Hans Ruck23-Jul-02 22:05
Hans Ruck23-Jul-02 22:05 
GeneralRe: OnCmdMsg Pin
Anonymous23-Jul-02 22:51
Anonymous23-Jul-02 22:51 
GeneralRe: OnCmdMsg Pin
Tomasz Sowinski24-Jul-02 0:30
Tomasz Sowinski24-Jul-02 0:30 
GeneralRe: OnCmdMsg Pin
Hans Ruck24-Jul-02 0:37
Hans Ruck24-Jul-02 0:37 
GeneralRe: OnCmdMsg Pin
Tomasz Sowinski24-Jul-02 0:42
Tomasz Sowinski24-Jul-02 0:42 
QuestionCFileDialog bug on W2k !? Pin
Mandalay23-Jul-02 21:57
Mandalay23-Jul-02 21:57 
AnswerRe: CFileDialog bug on W2k !? Pin
ttzzgg_8071323-Jul-02 22:25
ttzzgg_8071323-Jul-02 22:25 
GeneralRe: CFileDialog bug on W2k !? SURE !?? Pin
Mandalay23-Jul-02 22:33
Mandalay23-Jul-02 22:33 
AnswerRe: CFileDialog bug on W2k !? Pin
Tomasz Sowinski24-Jul-02 0:33
Tomasz Sowinski24-Jul-02 0:33 
GeneralRe: CFileDialog bug on W2k !? Pin
Mandalay24-Jul-02 1:57
Mandalay24-Jul-02 1:57 
GeneralRe: CFileDialog bug on W2k !? Pin
Tomasz Sowinski24-Jul-02 2:02
Tomasz Sowinski24-Jul-02 2:02 
Generalfile system events Pin
sunil goyal23-Jul-02 21:49
sunil goyal23-Jul-02 21:49 
GeneralRe: file system events Pin
567890123423-Jul-02 22:47
567890123423-Jul-02 22:47 
GeneralAdd links to windows popup menus Pin
sunil goyal23-Jul-02 21:42
sunil goyal23-Jul-02 21:42 
GeneralRe: Add links to windows popup menus Pin
benjymous23-Jul-02 23:16
benjymous23-Jul-02 23:16 
GeneralConstructors - throw an exception if failed Pin
tom7623-Jul-02 21:36
tom7623-Jul-02 21:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.