Assembly (mixed-source):void Static(void) { static int array1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; } void Automatic(void) { int array1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; }
32: void Static(void) 33: { 34: static int array1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 35: } 37: void Automatic(void) 38: { 39: int array1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 00401248 mov dword ptr [ebp-28h],1 0040124F mov dword ptr [ebp-24h],2 00401256 mov dword ptr [ebp-20h],3 0040125D mov dword ptr [ebp-1Ch],4 00401264 mov dword ptr [ebp-18h],5 0040126B mov dword ptr [ebp-14h],6 00401272 mov dword ptr [ebp-10h],7 00401279 mov dword ptr [ebp-0Ch],8 00401280 mov dword ptr [ebp-8],9 00401287 mov dword ptr [ebp-4],0Ah 40: }
Assembly:char s1[] = {'H', 'e', 'l', 'l', 'o'}; // array of 5 chars char s2[] = {'H', 'e', 'l', 'l', 'o', 0}; // array of 6 chars char s3[] = "Hello"; // array of 6 chars; 5 + NULL terminator char *s4 = "Hello"; // pointer to string of 6 chars; 5 + NULL terminator
9: char s1[] = {'H', 'e', 'l', 'l', 'o'}; // array of 5 chars 00401118 mov byte ptr [ebp-8],48h 0040111C mov byte ptr [ebp-7],65h 00401120 mov byte ptr [ebp-6],6Ch 00401124 mov byte ptr [ebp-5],6Ch 00401128 mov byte ptr [ebp-4],6Fh 10: char s2[] = {'H', 'e', 'l', 'l', 'o', 0}; // array of 6 chars 0040112C mov byte ptr [ebp-10h],48h 00401130 mov byte ptr [ebp-0Fh],65h 00401134 mov byte ptr [ebp-0Eh],6Ch 00401138 mov byte ptr [ebp-0Dh],6Ch 0040113C mov byte ptr [ebp-0Ch],6Fh 00401140 mov byte ptr [ebp-0Bh],0 11: 12: char s3[] = "Hello"; // array of 6 chars, 5 + NULL terminator 00401144 mov eax,[string "Hello" (0042101c)] 00401149 mov dword ptr [ebp-18h],eax 0040114C mov cx,word ptr [string "Hello"+4 (00421020)] 00401153 mov word ptr [ebp-14h],cx 13: char *s4 = "Hello"; // pointer to constant string of 6 chars, 5 + NULL terminator 00401157 mov dword ptr [ebp-1Ch],offset string "Hello" (0042101c) 14: }