I want to display contents of a array at once. In detail, what I want to do is, I need to create a sting in which contents of array is stored.
This is required because I am using a task to display a characters and that task requires string.
- In case of printing characters directly on screen, what I want to do can be realized like:
logic extra_bit ;
int loop = 10;
extra_bit = new[loop];
for(int i=0;i < loop; i++)
extra_bit=$urandom%2;
$write(“Contents of array: “); // display
for(int 1=0; i< loop; i++) // display
$write(”%b ,”,extra_bit[i]) // display
$write(“\n”); // display
Above code will produce a message like:
Contents of array: 1, 0, 1, 1, 0, 0, 0, 0, 1, 0
Now I need to create a string storing the characters generated by the code:
“for(int 1=0; i< loop; i++)
$write(”%b ,",extra_bit[i])
"
Note: “,” is inserted as a delimiter.
How I can do this?
Regards,
Matsumoto