Hello:
First of all, I don't know if this is going here.
I made an example with C # about resizing the array. I want to do the same but with Arduino IDE. What has to be shown in ARduino IDE is in the "Serial Monitor", in which the command is used:
[u]Code C of Arduino IDE[/u]:
Serial.println("This text is displayed in the Serial Monitor.");
The code I have below C #, I want to somehow transform it into Arduino IDE. Actually this is a silly example to understand what it does to enlarge or reduce array size in C #, but I want to do it in C of Arduino IDE.
Code C#:
using System;
namespace Cambiar_tamaño_array_INGLES_consola_02_cs
{
class Program
{
static void Main(string[] args)
{
// Window title.
Console.Title = "Array size";
// Residemensiona screen. X = 68, Y = 36.
Console.SetWindowSize(68, 36);
// Create and initialize a new array of strings.
String[] miArray = {"Hello", "my", "very", "distinguished", "friend.",
"How", "are", "you", "arround here?"};
// Displays the values of the array.
Console.WriteLine(
"The string array initially contains the following values:");
MostrarIndicesYValores(miArray);
// Resize the array to a larger size (five larger elements).
Array.Resize(ref miArray, miArray.Length + 5);
// Displays the values of the array.
Console.WriteLine("After resizing to a larger size, ");
Console.WriteLine("the string array contains the following values:");
MostrarIndicesYValores(miArray);
// Resize the array to a smaller size (four elements).
Array.Resize(ref miArray, 4);
// Displays the values of the array.
Console.WriteLine("After resizing to a smaller size, ");
Console.WriteLine("the string array contains the following values:");
MostrarIndicesYValores(miArray);
// Press any key to exit.
Console.ReadKey();
}
public static void MostrarIndicesYValores(String[] miArray)
{
for (int i = 0; i < miArray.Length; i++)
{
Console.WriteLine(" [{0}] : {1}", i, miArray[i]);
}
Console.WriteLine();
}
}
Result: