标题:使用bzero或者memset对每维清零后赋不起值
取消只看楼主
Mrluoyuzhao
Rank: 1
等 级:新手上路
帖 子:5
专家分:7
注 册:2021-9-1
结帖率:50%
已结贴  问题点数:20 回复次数:1 
使用bzero或者memset对每维清零后赋不起值
#include <stdio.h>
#include <string.h>

int main()
{
        char buf[3][3];
        int i;
        int j;

        for (i = 0; i < 3; i++) {
            for (j = 0; j < 3; j++) {
                bzero(buf[i], 3);
                buf[i][j] = '1';
                printf("buf[%d][%d]:%c\n", i, j, buf[i][j]);                                
            }
        }
        for (i = 0; i < 3; i++) {                                                                    
            for (j = 0; j < 3; j++) {                                                                    
                printf("%p,%p\n", buf[i], &buf[i][j]);                                             
                printf("buf[%d][%d]:%c\n", i, j, buf[i][j]);
            }                                                                           
        }

        return 0;
}
// buf[]每个维度(指针)地址我也打印出来没问题的,但是bzero后就是赋不起值,请问各位大佬是怎么回事呢
搜索更多相关主题的帖子: printf int for i++ include 
2021-09-02 16:44
Mrluoyuzhao
Rank: 1
等 级:新手上路
帖 子:5
专家分:7
注 册:2021-9-1
得分:0 
回复 2楼 自由而无用
你这是啥意思哦??
2021-09-02 17:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-506737-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.973609 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved