Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Various char arrays

Part of ArraysCategory

Description

Shows usage for some dynamic char arrays

Example

import std.string;


char[][][] FieldValues;
char[][] Fields;
char[] myStr;

int[] nums;
int[][] morenums;


int main(char[][] args)
{
    int i;
    for(i=0; i<args.length; i++)
    {
        printf("\n" ~ args[i] ~ "\n");
    }

    nums.length = 5;
    nums[0] = 47;
    printf(toString(nums[0]));

    morenums.length = 10;
    morenums[0].length = 10;
    morenums[0][0] = 56;
    printf(toString(morenums[0][0]));

    Fields.length = 15;
    Fields[][0] = "Testing (2d)         blah blah blah.........\n";
    printf(Fields[][0]);

    printf("Hello.\n");

    myStr = "My string!";
    FieldValues.length = 10;
    FieldValues[0].length = 10;
    FieldValues[][0][0] = myStr; //"Testing.";    
  
    printf(FieldValues[][0][0]);

    return 0;
}

Source

Link http://www.dsource.org/tutorials/index.php?show_example=67
Posted by jcc7
Date/Time Sun Jun 27, 2004 10:05 pm