C:获取整数的位

问题描述 投票:-3回答:1

我有一个程序,将两个4字节整数作为输入,我需要将这些存储到整数数组,如此...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main (int argc, char *argv[]) {
    int vals1[32], vals2[32];
    int num1 = atoi(argv[1]);
    int num2 = atoi(argv[2]);

    // so argv[1] might be 47 and I would want to set the values of the vals1 array to reflect that in binary form
}

有什么建议?

c binary integer
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.