Похожие чаты

A string and a string array of one string, given

that array contains the first string, between the array and the string, which of the two uses more memory?

5 ответов

14 просмотров

both array and string are struct type. the memory used by the string is actually inside the memory used by the array

String uses a bit more as it doesn't have a size and it needs pointer to the memory where the string is stored and information on its length... but it is much easier to use string compared to string array.

Llll- Автор вопроса
Talula
String uses a bit more as it doesn't have a size a...

Well, I thought c# strings have their sizes determined by the number of char values in them?

Llll
Well, I thought c# strings have their sizes determ...

That wouldn't really work in real life because if the size of the string changes then it is a problem for example when you define a string it is always 0 length, but when you put something in it, it gets bigger and you could simply do a += "TEST"; And it'll get bigger, this is an issue because if there is something in the way like the memory is used by some other variable, it has to jump it or move it, this can't happen... This is why C# would maintain a special area for strings and manage it there, which has to have length associated with it... (I guess) otherwise it won't be able to keep the information or change it. While string array or char array has a limitation of size, you can't overflow the length... and it has null termination.

Llll- Автор вопроса
Talula
That wouldn't really work in real life because if ...

At runtime, what memory do text boxes use or any data container use to store data?

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта