Hot!Declaring and initialising a number of arrays

Page: < 12 Showing page 2 of 2 - Powered by APG vNext Trial
Author
DarioG
Allmächtig.
  • Total Posts : 53419
  • Reward points : 0
  • Joined: 2006/02/25 08:58:22
  • Location: porcodioland
  • Status: offline
Re: Declaring and initialising a number of arrays 2018/06/13 14:20:21 (permalink)
0
still better than Doc Brown's one ;)
 
PS: watched Project Almanac yesterday. Oh well...

DEUTSCHLAND TOOOOOR!!! Brandenburger springt :D

#21
1and0
Access is Denied
  • Total Posts : 8006
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: Declaring and initialising a number of arrays 2018/06/13 14:24:00 (permalink)
+1 (1)
DarioG
still better than Doc Brown's one ;)
 
PS: watched Project Almanac yesterday. Oh well...

Doc Brown … Back to the Future.
#22
dan1138
Super Member
  • Total Posts : 2746
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: Declaring and initialising a number of arrays 2018/06/13 17:22:40 (permalink)
+1 (1)
There are a lot of ways to declare initialized memory arrays.
 
Here are three:
/**
  Section: Global Variables
*/
#if defined(TYPE1)
const unsigned char message_01[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x31};
const unsigned char message_02[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x32};
const unsigned char message_03[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x33};
const unsigned char message_04[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x34};
const unsigned char message_05[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x35};
const unsigned char message_06[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x36};
const unsigned char message_07[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x37};
const unsigned char message_08[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x38};
const unsigned char message_09[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x39};
const unsigned char message_10[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x31};
const unsigned char message_11[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x32};
const unsigned char message_12[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x33};
const unsigned char message_13[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x34};
const unsigned char message_14[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x35};
const unsigned char message_15[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x36};
const unsigned char message_16[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x37};
const unsigned char message_17[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x38};
const unsigned char message_18[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x39};
const unsigned char message_19[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x31};
const unsigned char message_20[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x32};
const unsigned char message_21[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x33};
const unsigned char message_22[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x34};
const unsigned char message_23[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x35};
const unsigned char message_24[20] = {0x4D, 0x72, 0x73, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x36};
const unsigned char message_25[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x31};
const unsigned char message_26[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x32};
const unsigned char message_27[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x33};
const unsigned char message_28[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x34};
const unsigned char message_29[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x35};
const unsigned char message_30[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x36};
const unsigned char message_31[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x37};
const unsigned char message_32[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x38};
const unsigned char message_33[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x68, 0x65, 0x64, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x39};
const unsigned char message_34[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x31};
const unsigned char message_35[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x32};
const unsigned char message_36[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x33};
const unsigned char message_37[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x34};
const unsigned char message_38[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x35};
const unsigned char message_39[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x36};
const unsigned char message_40[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x37};
const unsigned char message_41[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x38};
const unsigned char message_42[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x39};
const unsigned char message_43[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x31};
const unsigned char message_44[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x32};
const unsigned char message_45[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x33};
const unsigned char message_46[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x34};
const unsigned char message_47[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x35};
const unsigned char message_48[20] = {0x44, 0x6F, 0x63, 0x20, 0x42, 0x72, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x64, 0x6F, 0x6F, 0x72, 0x36};
#elif defined(TYPE2)
const unsigned char message[48*20+1] = {
"Doc Brown side door6"
"Doc Brown side door5"
"Doc Brown side door4"
"Doc Brown side door3"
"Doc Brown side door2"
"Doc Brown side door1"
"Doc Brown back door9"
"Doc Brown back door8"
"Doc Brown back door7"
"Doc Brown back door6"
"Doc Brown back door5"
"Doc Brown back door4"
"Doc Brown back door3"
"Doc Brown back door2"
"Doc Brown back door1"
"Doc Brown shed door9"
"Doc Brown shed door8"
"Doc Brown shed door7"
"Doc Brown shed door6"
"Doc Brown shed door5"
"Doc Brown shed door4"
"Doc Brown shed door3"
"Doc Brown shed door2"
"Doc Brown shed door1"
"Mrs Brown side door6"
"Mrs Brown side door5"
"Mrs Brown side door4"
"Mrs Brown side door3"
"Mrs Brown side door2"
"Mrs Brown side door1"
"Mrs Brown back door9"
"Mrs Brown back door8"
"Mrs Brown back door7"
"Mrs Brown back door6"
"Mrs Brown back door5"
"Mrs Brown back door4"
"Mrs Brown back door3"
"Mrs Brown back door2"
"Mrs Brown back door1"
"Mrs Brown shed door9"
"Mrs Brown shed door8"
"Mrs Brown shed door7"
"Mrs Brown shed door6"
"Mrs Brown shed door5"
"Mrs Brown shed door4"
"Mrs Brown shed door3"
"Mrs Brown shed door2"
"Mrs Brown shed door1"
};
#else
const unsigned char message[48*20] = {
'D','o','c',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','6',
'D','o','c',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','5',
'D','o','c',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','4',
'D','o','c',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','3',
'D','o','c',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','2',
'D','o','c',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','1',
'D','o','c',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','9',
'D','o','c',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','8',
'D','o','c',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','7',
'D','o','c',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','6',
'D','o','c',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','5',
'D','o','c',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','4',
'D','o','c',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','3',
'D','o','c',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','2',
'D','o','c',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','1',
'D','o','c',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','9',
'D','o','c',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','8',
'D','o','c',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','7',
'D','o','c',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','6',
'D','o','c',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','5',
'D','o','c',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','4',
'D','o','c',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','3',
'D','o','c',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','2',
'D','o','c',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','1',
'M','r','s',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','6',
'M','r','s',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','5',
'M','r','s',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','4',
'M','r','s',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','3',
'M','r','s',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','2',
'M','r','s',' ','B','r','o','w','n',' ','s','i','d','e',' ','d','o','o','r','1',
'M','r','s',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','9',
'M','r','s',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','8',
'M','r','s',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','7',
'M','r','s',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','6',
'M','r','s',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','5',
'M','r','s',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','4',
'M','r','s',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','3',
'M','r','s',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','2',
'M','r','s',' ','B','r','o','w','n',' ','b','a','c','k',' ','d','o','o','r','1',
'M','r','s',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','9',
'M','r','s',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','8',
'M','r','s',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','7',
'M','r','s',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','6',
'M','r','s',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','5',
'M','r','s',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','4',
'M','r','s',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','3',
'M','r','s',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','2',
'M','r','s',' ','B','r','o','w','n',' ','s','h','e','d',' ','d','o','o','r','1'
};
#endif

#23
Page: < 12 Showing page 2 of 2 - Powered by APG vNext Trial
Jump to:
© 2018 APG vNext Trial Version 4.5