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;
}

评论

trang chủ - Wiki
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-05 18:37
浙ICP备14020137号-1 $bản đồ khách truy cập$