Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- ////////////////////////////////////////////////////
- struct Cday
- {
- int nYear;
- const char *pszDay;
- int nSec;
- };
- void foo(Cday d);
- ////////////////////////////////////////////////////
- int main() //
- {
- Cday day1;
- day1.nYear = 2022;
- day1.pszDay = "Monday";
- day1.nSec = 1688169600;
- printf("size Cday = %d\n", sizeof(day1) );
- printf("address day1 = %d\n", &day1);
- foo(day1);
- }
- ////////////////////////////////////////////////
- void foo(Cday d)
- {
- printf("address d = %d\n", &d);
- printf("d.nYear = %d\n", d.nYear );
- printf("d.pszDay = %s\n", d.pszDay);
- printf("d.nSec = %d\n", d.nSec );
- printf(" - - - - - - -\n\n\n\n" );
- printf("d.nYear = %d\n", d );
- int *p = (int*)&d;
- p = p + 1; printf("d.pszDay = %s\n", *p );
- p = p + 1; printf("d.nSec = %d\n", *p );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement