1.  >>  高等继续教育 / 高级语言程序设计
 高等继续教育 / 高级语言程序设计
正确率:郑大成教%

下列程序段的输出结果为()。

struct Node {
    int data;
    struct Node* next;
};
int main() {
    struct Node n1 = {1, NULL};
    struct Node n2 = {2, &n1};
    struct Node n3 = {3, &n2};
    struct Node n4 = {4, &n3};
    struct Node* head = &n4;
    struct Node* ptr = head;
    while (ptr != NULL) {
        printf("%d ", ptr->data);
        if (ptr->next != NULL) {
            ptr = ptr->next->next;
        } else {
            ptr = ptr->next;
        }
    }
    return 0;
}



4 3 2 1


4 3


4 2 1


4 2

 参考答案:
 佳题速递: