c语音编程菜鸟,求助
//我想请教一下为什么主函数返回的值都是相同的??????是什么原因呢??谢谢!#include "stdafx.h"
#include <stdlib.h>//可省略
#define length 6 //数据荷载的值
struct src_packet
{
int order;
int ID; //区分媒体数据包和冗余包的标识符,定义为bool型
int group; //组号
char *data; //数据包里面的数据域
};
struct src_packet src_pack[30];
static struct src_packet rong_pack[3];
//char str[7]="000000";
char ldpc_encode()
{
//*a[30]为接收到的数据
char *a[30]={"100110","110010","001010","010100","111100","000011","111110","001001","101000","001010","101010","001010","000001","100101","011100","100111","011000","010110","110100","001110","110010","011001","101001","001110","001010","010010","000000","100101","000100","100111"};
//struct src_packet src_pack[30];
//struct src_packet rong_pack[3];
//LDGM生成矩阵
int LD_H[][30]={{0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,1,0,0},{0,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0},{1,0,0,0,0,1,1,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,1}};
int i,m,n;
int j=1;
int Ctrl_input=1;
for (i=1;i<=30;i++)
{
if (Ctrl_input==1)
{
src_pack[i-1].data=*(a+i-1);
src_pack[i-1].order=i;
src_pack[i-1].group=j;
src_pack[i-1].ID=1;
}
else break;
}
//for(k=0;k<30;k++)
//printf("data:%7s\norder:%d\ngroup:%d\nID:%d\n",src_pack[k].data,src_pack[k].order,src_pack[k].group,src_pack[k].ID);
//以下是预编码
for(m=0;m<3;m++)
{
char str[]="000000";
for(n=0;n<30;n++)
{
if(LD_H[m][n]==1)
{
for(int t=0;t<length;t++)
{
//int c=str[t]-48; //字符型转换为整形,0对应的ASCALL码为48
//int b=src_pack[n].data[t]-48;//字符型转换为整形
//str[t]=(c+b)%2+48;//整型转换为字符型
str[t]=(int)(str[t]^src_pack[n].data[t])+'0';
}
}
}
rong_pack[m].data=str;
rong_pack[m].order=src_pack[0].order;
rong_pack[m].group=src_pack[0].group;
rong_pack[m].ID=0;
printf("data:%s %s\n",str,rong_pack[m].data);
//return rong_pack[m];
}
return 1;
}
void main()
{
ldpc_encode();
for(int i=0;i<3;i++)
printf("%s ",rong_pack[i].data);
} 编码 c
补充:.NET技术 , C#