Telegram Group & Telegram Channel
Что за ошибка в приведенном ниже коде и как ее исправить?

Последним аргументом memset должен быть sizeof(*bar), а не sizeof(bar). sizeof(bar) вычисляет размер bar (то есть самого указателя), а не размер структуры, на которую указывает bar. Поэтому код можно исправить, используя sizeof(*bar) в качестве последнего аргумента вызова memset.

➡️ @cpp_geek



tg-me.com/cpp_geek/270
Create:
Last Update:

Что за ошибка в приведенном ниже коде и как ее исправить?

Последним аргументом memset должен быть sizeof(*bar), а не sizeof(bar). sizeof(bar) вычисляет размер bar (то есть самого указателя), а не размер структуры, на которую указывает bar. Поэтому код можно исправить, используя sizeof(*bar) в качестве последнего аргумента вызова memset.

➡️ @cpp_geek

BY C++ geek




Share with your friend now:
tg-me.com/cpp_geek/270

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Tata Power whose core business is to generate, transmit and distribute electricity has made no money to investors in the last one decade. That is a big blunder considering it is one of the largest power generation companies in the country. One of the reasons is the company's huge debt levels which stood at ₹43,559 crore at the end of March 2021 compared to the company’s market capitalisation of ₹44,447 crore.

telegram from in


Telegram C++ geek
FROM USA