c - How do you store an array into a variable? -


if have array of 4 values, how store values 1 variable?

    char d[4];     int allvalues;     d[0] = 1;     d[1] = 2;     d[2] = 3;     d[3] = 4; 

i want allvalues = 1234. if add piece of code, output comes out different.

  allvalues = d;   printf("%d", allvalues); 

thank you!

allvalues = d[3] + 10 * ( d[2] + 10 * ( d[1] + 10 * d[0])); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -