如果这令人困惑,我很抱歉....到目前为止,我正在将十进制数转换为二进制数.在执行此操作时,我将二进制表示的数字存储到int数组中.
EX:对于数字4.(这在下面的dec2bin中完成)
temp[0] = 1
temp[1] = 0
temp[2] = 0
Run Code Online (Sandbox Code Playgroud)
我想将这个数组存储到另一个包含多个'temp'数组的数组(比如BinaryArray)中.
我希望BinaryArray声明为main,传递给dec2bin,并保存当前临时数组的副本.然后转到下一个号码.
我在找出指针以及不需要的东西时遇到了麻烦.如果有人可以帮助我如何在main中声明所需的数组以及如何从dec2bin添加它.
谢谢!主要:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
void dec2bin(int term, int size);
int size, mincount;
int * ptr;
int x;
x=0;
scanf("%d %d", &size, &mincount);
printf("Variables: %d\n", size);
printf("Count of minterms: %d\n", mincount);
int input[mincount+1];
while(x < mincount){
scanf("%d", &input[x]);
x++;
}
x = 0;
while(x < mincount){
dec2bin(input[x], size);
Run Code Online (Sandbox Code Playgroud)
Dec2bin:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 32
void
dec2bin(int term,int …Run Code Online (Sandbox Code Playgroud)