在C中,當我創建任何n元組並嘗試使用它時,我只能使用它的最後一個元素。即使類型顯然是元組的最後一個元素,而不是元組本身。我怎樣才能獲得最後一個元素以外的元素?我通過規範快速查看,並沒有看到它。如何獲取兩個元組的最後一個元素以外的元素?
例子:
#include <stdio.h>
int f() {return 2;}
char* g() {return "dudebro";}
int main() {
printf("%d\n", (f(),g(),3)); /* Should print the address of the tuple (unless it's by-value, in which case it should be a compile error) but prints the last element?*/
return 0;
}
運行:
$ gcc -ansi -pedantic -Wall -Wextra tt.c -o tt
$ ./tt
3
ohhhhhhhhhh。大聲笑。 – megazord