小编ros*_*ose的帖子

违反C中的静态功能

在一次采访中我被问到,如果在一个文件A中定义了一些静态函数,在文件B中你想要使用这个静态函数 - 你将如何使用它?

我的答案是:

  1. 在.h文件中声明但是如果我们在头文件中声明,包含它的其他文件也可以访问这个静态函数.
  2. 包装器概念:newfun在文件A中声明一个新函数,它将调用静态函数并newfun在文件B中调用它.

但他对这些答案并不满意.

能否请你提供一些更好的违规解决方案static.

c static

6
推荐指数
2
解决办法
387
查看次数

导入 _ssl 错误,DLL 加载失败,Python 37 Anaconda Windows 10

我在 Win10 上遇到 _ssl 问题。我已将 python 包和代码从 Windows 7 移至 Windows 10。一开始我面临以下问题:

导入错误:缺少必需的依赖项 ['numpy']

但是这个问题通过重新安装 numpy 和 pandas 的 .whl 包得到了解决。

目前我在执行代码时面临以下问题:

import _ssl             # if we can't import it, let the error propagate
    ImportError: DLL load failed: The specified procedure could not be found. 
Run Code Online (Sandbox Code Playgroud)

参考关于堆栈溢出的其他问题并尝试了几个步骤:

  1. 按照此Python 3.7 anaconda 环境中的建议更改路径变量- 导入 _ssl DLL 加载失败错误

  2. 安装 pyopenssl 。

  3. 更新了系统环境变量。

  4. 重新启动了pycharm。

目前在 Anaconda 提示符下显示为:

   (base) C:\>
   (base) C:\>python
    Python 3.7.0 (default, Aug 14 2018, 19:12:50) [MSC v.1900 32 bit …
Run Code Online (Sandbox Code Playgroud)

python dll anaconda

5
推荐指数
1
解决办法
8341
查看次数

atoi()函数如何处理非数字情况?

我试图编写自己的atoi()函数实现,并尝试了两个不同的代码:

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

int myatoi(const char *string);

int main(int argc, char* argv[])
{
    printf("\n%d\n", myatoi("str"));
    getch();

    return(0);
}  

int myatoi(const char *string){
    int i;
    i=0;
    while(*string)
    {
        i=(i<<3) + (i<<1) + (*string - '0');
        string++;
        // Don't increment i!
    }
    return i;
}
Run Code Online (Sandbox Code Playgroud)

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

int main() {
    char str[100];
    int x;
    gets(str);
    printf("%d",myatoi(str));
}

int myatoi(char *str) {

    int res =0;
    int i;

    for (i = 0; str[i]!= '\0';i++) {
        res = …
Run Code Online (Sandbox Code Playgroud)

c atoi

2
推荐指数
1
解决办法
1172
查看次数

标签 统计

c ×2

anaconda ×1

atoi ×1

dll ×1

python ×1

static ×1