Похожие чаты

Struct Info { char

ch;
int id;
};

auto ptr = new Info;

it is confuse me, I am beginner .
so now info address is point to the first field argument which is allocated on the stack ? right ?

then ?!
is ch allocated on the heap ?

5 ответов

15 просмотров
Abdulrhman-Alhazmi Автор вопроса

Changing the fields as pointers struct Info { char *ch; int * id; }; the size of Info became larger than the last one which ( 8 bytes) ( because padding ) but it became ( 16 bytes ) after make them pointers ?! and the struct address is not pointing to the first field address which is not allocated yet ?!

it's defined on heap (physical address locator) and has a counter of references related with stack call handlers.

Abdulrhman Alhazmi
Changing the fields as pointers struct Info { ...

pointer's size may vary between 4 and 20 bytes, it depends of compiler.

Abdulrhman-Alhazmi Автор вопроса

Похожие вопросы

Обсуждают сегодня

Is UniBright Freequity an active live product ? A friend here in Asia was discussing the Tokenisation of RWA’s in his case Real Estate as he’s a developer with numerous overs...
Digital Trust
4
коллеги, добрый вечер! А никто не знает как модальная форма может себя закрыть? Ну допустим модальная форма определила, что смысла ей работать нет и хочет вернуть modalResult...
Михаил
83
Hi, is it fine to use git to backup my config? I did so many things that I don't want to miss if I switched to another OS, so how do you backup your home and configs? And shou...
Adnan Al_Beda
30
Добрый день задумываюсь о создание токена из за того что много свободного времени и вот я узнал что транзакции за перевод этого токена будут в waves и тут пришла идея при тран...
Артем
3
А если изначально бот работал так : есть сайт онлайн школы. У каждого ученика свой кабинет. Где он авторизуется по своим данным. И уже в кабинете, на самом сайте делает оплату...
Денис 💡 Фрилансер
13
А что ты вообще делаешь ?
Yesgoter
13
Crypto aman premium grp koi join kiya hai... Kaisa hai service any one idea??
Arvind Sharma
16
На работе пишем распределенное приложение, у которого сотни, если не тысячи настроек. Конфиги написаны на xml, расположены на разных хостах и должны быть согласованы друг с др...
Aleksandr Druzhinin
5
Hi, I am a bit confused... I just unbonded on app.persistence.one stkSTARS/STARS with a liquidity of $127. From a time period of 60 days and a reward percentage of 9.72% at t...
Matias
4
средствами IBX как-то можно выполнить запрос insert ... returning?
Igor
31
Карта сайта