小编Jon*_*ler的帖子

使用未声明的标识符'o'

#include <stdio.h>
#include <cs50.h>

int main(void) 
{
    int height;
    {
        printf("Please select a height value between 1-23.");
        height = GetInt();

        while (height < 1 || height > 23)
        {
            printf("Height mustbe between 1-23, please choose new value.\n");
            height = GetInt();
        }
        {
            for (int n = 0; n < height; n++)

            for (int o = 0; o + n + 1 < height; o++)
            {
                printf(" ");
            }            
            for (int p = 0; p <= o; p++)
            {
                printf("#");
            } …
Run Code Online (Sandbox Code Playgroud)

c cs50

-6
推荐指数
1
解决办法
762
查看次数

你能看到客户端的PHP脚本吗?

我只是要求这使我的网站尽可能安全,因为它将处理个人信息.这就是为什么我选择PHP来编码,因为它运行在所有服务器端,但我听说有一些技巧,你可以读取脚本,如果知道URL是脚本在哪里.我没有亲自看过这个我自己,所以我只是想要一些澄清,以确保PHP中的编码是这个安全明智的最佳选择.

基本上我希望至少有可能以某种方式被黑客入侵.一旦我完成了网站的开发,我将申请SSL证书,我知道这将有助于来回传输信息的加密.

php security ssl

-6
推荐指数
1
解决办法
976
查看次数

'undeclared identifier'错误,即使变量是在代码中先前声明的

inth当用户输入值时,在第10行声明变量.

但是,当代码编译时,它表示它是未声明的.

#include <cs50.h>
#include <stdio.h>

int main(void)
{
    printf("How tall would you like your pyramid?\n");
    bool inc = true;
    while (inc)
    {
        int h = GetInt();
        if (h <= 23 && h >= 1)
        {
            inc = false;
        }
        else
        {
            printf("your value needs to be between 1 and 26\n");
        }
    }

    for (int i=0; i<=h; i++)
    {
        printf("#\n");
    }
}
Run Code Online (Sandbox Code Playgroud)

c cs50

-6
推荐指数
1
解决办法
418
查看次数

#define DATA 10和#如果定义了DATA之间的区别

我在许多地方看到我们正在验证这样的陈述

 # if defined(DATA ) || defined(__hpux) || defined(__sun)
Run Code Online (Sandbox Code Playgroud)

我的疑问是:只有define喜欢#defined DATA和检查条件的含义是什么?

c c++ c-preprocessor

-6
推荐指数
1
解决办法
87
查看次数

“ char * accum(const char * source);”是什么?在C中意味着什么?

我正在研究Codewars中的一些编程实践,其中大多数都只从以下这一行开始使用:

char *accum(const char *source);
Run Code Online (Sandbox Code Playgroud)

我以前从未看过这种语法,这到底是做什么的?我假设它已将accum分配给源,但是我尝试打印accum,但此错误使我震惊:

undefined reference to `accum'
Run Code Online (Sandbox Code Playgroud)

c

-6
推荐指数
1
解决办法
130
查看次数

会输出多少个hello?是 16 吗?

这会产生 16 个副本hello吗?如果没有,有多少?

#include <stdio.h>
#include <unistd.h>

int main(void)
{

    printf("hello\n");
    fork();
    fork();
    fork();
    fork();
    return(0);

}
Run Code Online (Sandbox Code Playgroud)

c

-7
推荐指数
1
解决办法
109
查看次数

按位或不工作C.

请帮我这个代码.我不知道为什么输出不是8.

#include <stdio.h>
#include <stdlib.h>
int main(){
    char c;
    c = c & 0;
    printf("The value of c is %d", (int)c);
    int j = 255;
    c = (c | j);
    int i =0;
    while( (c & 1) == 1){
        i++;
        c = c>>1;
    }
    printf("the value of i is %d",i);
    system("pause");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

对于给我-1的所有人,我尝试打印这些值.但它进入了一个无限循环.

c

-8
推荐指数
1
解决办法
914
查看次数

更改了 C 程序中的注释及其导致的分段错误

这是提交之间的区别,只是注释和行间距不同,但旧的提交正常运行,而新的结果导致段错误:

Binary files a/recover/recover and b/recover/recover differ
diff --git a/recover/recover.c b/recover/recover.c
index f0ffdf6..02ab42b 100644
--- a/recover/recover.c
+++ b/recover/recover.c
@@ -1,34 +1,32 @@
-#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 
 typedef enum
 {
-   false,
-   true
-} bool;
+   true,
+   false
 
-typedef uint8_t BYTE;
+} bool;
 
 typedef char *string;
 
+typedef uint8_t BYTE;
 int BLOCK_SIZE = 512;
 
 int main(int argc, char *argv[])
 {
-   // Check if a file name was provided as an argument
-   if …
Run Code Online (Sandbox Code Playgroud)

c gcc clang gnu-make segmentation-fault

-8
推荐指数
1
解决办法
64
查看次数

标签 统计

c ×7

cs50 ×2

c++ ×1

c-preprocessor ×1

clang ×1

gcc ×1

gnu-make ×1

php ×1

security ×1

segmentation-fault ×1

ssl ×1