我想为hadamard矩阵执行这个c代码。如果有,我想为hadamard矩阵执行新代码

我想为hadamard矩阵执行这个c代码。如果有,我想为hadamard矩阵执行新代码,c,C,我试图编译这一代的代码。有人能告诉我为什么这个代码没有被执行吗 #include <stdio.h> #include <math.h> #include <conio.h> main() { int H_SIZE=32; /*length of each code word: you can change. */ int n,r1,c1,i,j; int hadamard_matrix[2][2]={{1,1},{1,0}}; /* Initialise

我试图编译这一代的代码。有人能告诉我为什么这个代码没有被执行吗

#include <stdio.h>
#include <math.h>
#include <conio.h>

main() {
int H_SIZE=32;  /*length of each code word: you can change. */
int n,r1,c1,i,j;
int hadamard_matrix[2][2]={{1,1},{1,0}}; /* Initialise 1x1 matrix */
for (r1=0;n<H_SIZE; r1*=2){
for(c1=0; c1<H_SIZE;c1*=2){
    while (r1<H_SIZE){
        for (i=0;i<r1;i++){ /* loop#1: Copying the code matrix itself    below for new code matrix */
            for (j=0;j<c1; j++){
            hadamard_matrix[i+r1][j]=hadamard_matrix[i][j];
        }
        }
        for (j=0; j<c1;j++){/* Loop#2: Copying the code matrix on right to itself for new matrix */
            for (i=0; i<r1;i++){
            hadamard_matrix[i][j+c1]=hadamard_matrix[i][j];
            }
        }
        for (i=0;i<r1;i++){/* Loop#3: Copying cojugate of code matrix for complentary diagonal part */
            for (j=0;j<c1;j++){
                hadamard_matrix[i+r1][j+c1]=hadamard_matrix[i][j];}}  
      }        
    }
   }
printf("%d\t", hadamard_matrix);
}
#包括
#包括
#包括
main(){
int H_SIZE=32;/*每个码字的长度:您可以更改*/
int n,r1,c1,i,j;
int hadamard_矩阵[2][2]={{1,1},{1,0};/*初始化1x1矩阵*/

对于(r1=0;n首先:通过编译器运行它,我敢打赌它不会编译。启用编译器警告

第二:

main() {
那不行。做:

void main(void) {
第三:

n<H_SIZE
这不是打印矩阵的方式


您似乎还缺少某个右括号。

代码是否生成?程序是否崩溃?程序是否生成意外输出?您是否尝试在调试器中单步执行它?请提供更多详细信息。
printf(“%d\t”,hadamard_matrix”);
main()
??
r1
start
0
,update by
r1*=2
=>always
0
@user2979190:我已使代码在您提到的问题中可见。它不应该被删除。@user3629249:实际上,大括号的数量是平衡的。布局很糟糕,但在每行的末尾都有一个紧大括号e没有一个头脑正常的人将它们放在适当的位置。最后的
printf()
语句将地址打印为整数;C没有内置的矩阵打印功能。
printf("%d\t", hadamard_matrix);