#JavaScript, 125 bytes
JavaScript, 125 bytes
I know it's longer than others, but I really wanted to use eval. Just for fun.
f=function(s){m=/^(\w+ )(\w+).*?(;.*)/.exec(s) eval("var "+m[2]+"=new Array()"+m[3]+'alert(m[1]+m[2]+"={"+eval(m[2])+"};")')} To run, paste the following into here:
s='int spam[6];\ spam[0] = 4;\ spam[1] = 8;\ spam[2] = 15;\ spam[3] = 16;\ spam[4] = 23;\ spam[5] = 42;' f=function(s){m=/^(\w+ )(\w+).*?(;.*)/.exec(s) eval("var "+m[2]+"=new Array()"+m[3]+'alert(m[1]+m[2]+"={"+eval(m[2])+"};")')} f(s)