var.array = (uint8_t)[]{0,1,2,3,4,5,6};
Do you mean a compound literal?
then the syntax is (uint8_t [])
instead of (uint8_t)[]
But you can not assign to an array (Why are arrays not lvalues).
Your first example is almost correct:
memcpy(var.array, (uint8_t){0,1,2,3,4,5,6}, 7);
but again, use the correct syntax:
memcpy(var.array, (uint8_t []){0,1,2,3,4,5,6}, 7);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…