Загрузка...

✅ Explanation Most people try to use sizeof to find string length That works for memory size,

✅ Explanation: Most people try to use sizeof to find string length. That works for memory size, not for string length 🔹 Why sizeof is wrong here: • sizeof(str) counts total bytes • It also includes the '\0' character • It does not stop at the end of the string 🔹 Why the loop is correct: • C strings end with '\0' • The loop counts characters until '\0' • This gives the actual length of the string • This is exactly how strlen() works internally 📌 Final takeaway • sizeof tells you how much memory is used. • The loop tells you how long the string is. . . . . . #coding #programming #programmer #python #developer #javascript #code #coder #technology #html #computerscience #codinglife #java #webdeveloper #tech #webdevelopment #css #softwaredeveloper #webdesign #linux #programmingmemes #machinelearning #datascience #artificialintelligence #webdev #frontend #reactjs #codingisfun #developerlife #learntocode

Видео ✅ Explanation Most people try to use sizeof to find string length That works for memory size, канала Pasha_Dev
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять