xqher 2024-01-25 21:24:57

广东专插本计算机真题0001 问题: 1)j=4时结果是? 2)程序运行结束后输出的结果是? 答案: 1)9 2)9 7 5 5 5

#include <stdio.h>

int main()
{
    int j, a[] = {1,3,5,7,9,11}, *p = a + 5;

    
    for (j = 4; j > 0; j--) {
        switch(j) {
            case 1:
            case 2: printf("%d ", *p); break;
            case 3: printf("%d ", *(--p));
            case 4: printf("%d ", *(--p));
        }
    }
    return 0;
}

评论

Главная - Вики-сайт
Copyright © 2011-2024 iteam. Current version is 2.139.0. UTC+08:00, 2024-12-25 15:18
浙ICP备14020137号-1 $Гость$