malloc and strings in C# | Sololearn: Learn to code for FREE!

malloc and strings in C#

As I first started in C, the most basics tasks I used to do in C using the console are just so confusing and I still donÔÇÖt get them in C#. How to make an empty string and later on the program add chars to each of its positions? As the string and its size are not defined when declaring the variable, I donÔÇÖt know how to do it. In C I would use malloc (memory allocation). The MSDN website, besides being amazing to have access to its content, itÔÇÖs still too ÔÇťadvancedÔÇŁ for autodidacts beginners.

12th Apr 2018, 2:10 PM
Arthur Boss
Arthur Boss - avatar
1 Antwort
+ 1
C is a really low level programming language C# is a much higher level programming language In C# a lot of work is done for you by the .net frame work. Higher is not better but means you do not have to worry about low level task like allocating memory. string input; //to define a string no size needed input = "hello"; //to assign hello to the string input = input + "world"; //to add characters to the string input = ""; //to clear the string
12th Apr 2018, 8:52 PM
sneeze - avatar