求助,为什么输出很奇怪?

P1319 压缩技术

tiying @ 2023-08-21 21:59:53

#include<stdio.h>
int n,i=0,f =1,cur;
int main(void){
    scanf("%d",&n);
    n = n*n;
    while(n){
        scanf("%d",&cur);
        f = !f;
        n = n-cur;
        for(cur;cur>0;cur--){
            printf("%d",&f);
            i++;
            if(i==n){
                i=0;
                printf("\n");
            }
        }
    }
    return 0;
}

by free_fall @ 2023-08-21 22:02:34

@tiying printf("%d",&f); 这里把&去掉,不然输出的是地址。


by tiying @ 2023-08-21 22:04:57

@free_fall 谢谢,太粗心了


|