gpt4 book ai didi

地穴(): Pointer to integer without cast?

转载 作者:行者123 更新时间:2023-12-02 07:35:04 28 4
gpt4 key购买 nike

啊!为什么编译器会提示?感谢您的帮助!

% gcc -o mine mine.c -lcrypt
mine.c: In function 'main':
mine.c:19:14: warning: assignment makes pointer from integer without a cast [enabled by default]
%

代码:

#define _X_OPEN_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main() {

const char key[] = "hello world";
const char salt[]="01";
const int MAXIMUM_HASH_LENGTH = 2 + 11;
int i=0;

char *hash;

long long hashes = 0L;

while (1) {

hash = crypt(key, salt); /* problem with this line... */
if (hash[2] == '0') {
int leading0s = 0;
leading0s++;
for (i=3; i < MAXIMUM_HASH_LENGTH; i++) {
if (hash[i] != '0') break;

leading0s++;
}
printf("Winner: %s has %d leading zeros.\n",
hash, leading0s);
printf("\t--> Hash %lld.\n\n", hashes);
}

if (hashes != 0 && (hashes % 10000) == 0) {
printf("Hash %d: %s\n", hashes, hash);
}

if (hashes== 1000000) break;
hashes++;

}

return 1000;

}

最佳答案

尝试将“#define _X_OPEN_SOURCE”更改为“#define _XOPEN_SOURCE”。

关于地穴(): Pointer to integer without cast?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17509606/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com