
[英]Hash tables (dispersion) representation on paper
假设我有一个 function, h(x)=[½(x mod 8)] 。 当我绘制 hash 表(分散)时,索引将从 0->7 还是 0->3。 ( []意味着它只需要 integer 部分。) 我期望它是 0->3,但我的一些同学说它是 0->7。 ...
[英]Hash tables (dispersion) representation on paper
假设我有一个 function, h(x)=[½(x mod 8)] 。 当我绘制 hash 表(分散)时,索引将从 0->7 还是 0->3。 ( []意味着它只需要 integer 部分。) 我期望它是 0->3,但我的一些同学说它是 0->7。 ...
[英]The second generation is bugged (C, Conways Game of Life)
嘿,所以我的问题是,当我 go 运行此代码并选择“Zufallstand generieren”(生成随机状态),然后输入“Prozentualer Anteil lebender Zellen”(活细胞百分比),然后输入“Schrittweise Animation”或“ Fließende A ...
[英]Controlling Timer0 in ATmega328p
我正在尝试为我的 arduino uno R3 的 ATmega328p 创建阻塞延迟。 但我的 function 遇到了问题。 我不确定它是否与我的时钟源有关。 我在脚本顶部将其设置为 8 MHz,但问题仍然存在。 这是我的延迟 function 的片段,它配置为 8 MHz 时的 10 毫秒延 ...
[英]Reading UDP packets with several clients
我在本地安装了一个应用程序(不是我开发的),它每秒广播 UDP 个数据包。 从我的应用程序(在 Windows 中的 C++ 中开发)读取数据包,该应用程序也是本地安装的,工作正常。 但我最近注意到,在我测试一些代码时,当我的应用程序正在运行时,bind(...) function 返回错误代码 1 ...
[英]Cannot modify an array passed to a function
这是我的代码: 我的任务是为学生创建一个数据库。 我用男名和女名创建了 arrays,这样程序就可以为 20 个“创建”的人随机分配名字和姓氏。 我在losowanieImionINazwisk中试图实现的是传递一个数组并在wygeneroanieStudentow方法中修改它。 问题是,该程序无法 ...
[英]Function or macro definition which one to use
我有一些经常使用的宏所以我在想在我的情况下使用 function 还是使用宏定义会更好? 我使用的宏代码示例: 根据上面的代码,使用什么会更好? 继续使用宏定义还是迁移到 function? ...
[英]executing the command "cat" with no options in c
如果没有给出 arguments 或重定向使用,则 cat 命令从标准输入读取。 但是当我用execve()执行它时,它的行为不像在 bash 中那样。 代码: Output: 我尝试在没有 arguments 的情况下运行它,但它返回错误。 ...
[英]"invalid ELF header" using ctypes in lambda
尝试使用 lambda 中的ctypes从 python 调用 c function 并得到: 在本地它工作正常。 我是如何得到这个错误的: 创建 C function 从这个 function 创建 *.so 文件使用 ctypes 检查本地此代码是否正常工作将 *.py 和 *.so 文件放入 ...
[英]Is there a way to find out if I am running inside a Flatpak, AppImage or another sandboxed environment in C?
我想重写我的库的一部分以使用 Flatpaks 和其他可能对我的权限有限制的沙盒环境。 有没有办法确定进程是否在这样的环境中? ...
[英]count>=10? break : continue;
while(1) { // other stuff // there's no code in the loop after the below statement: count>=10? break : continue; // error } 为什么这个语句会报 ...
[英]Loop doesn't finish when reading from pipe
我正在关注 Arpaci-Dusseau 的免费书籍操作系统:三篇简单的文章,尽管对 C 编程还很陌生(欢迎提出建设性的批评),但我还是尝试了第 5 章中的编码问题 8: 编写一个创建两个孩子的程序,并使用pipe()系统调用将其中一个的标准 output 连接到另一个的标准输入。 这是我的尝试(为 ...
[英]simple program to get and display name and dob of friend what is the error
该程序告诉我们从朋友那里获取输入名称和出生日期,并使用结构显示它。 OUTPUT:enter details dasd 10 10 2004 name is £ and dob is 0/35/11408852 为什么 output 给出这个垃圾值? ...
[英]How to make a new line counter in c? I have idea, but it doesn't work
我正在学习 C 编程从一本书“C 程序设计语言,第 2 版”和 1.5.3。 段落有一个创建新行计数器的解决方案,但是当我试图重写它并自己编译时它没有用。 尝试在下一行输入文本并使用 CTRL + D 后,程序返回 0。但我想看到一个非零的数字 ...
[英]i have been on this question for quaring the document for two days straight, and it is not working. don't want to cheat, can you point the problem
我无法调试正在发生的事情。 代码似乎是正确的,但我对指针的指针不熟悉,这里有 4 个系列。#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> # ...
[英]How to make a develop env by using singularity+vscode
我为 arm 开发创建了一个奇点图像。 我在我的 WSL 中安装了一个奇点。 我将在wsl上编码和调试,然后在我的奇异点使用交叉编译器将其移动到arm平台。 如何使用vscode构建我的程序(arm版)? 或者如何将奇点与 vscode 结合使用? 我尝试用奇点 shell 构建我的程序,它成功了。 ...
[英]Problem displaying png file from web server to client web browser in C
我正在 C 中实现一个 web 服务器,并尝试向 Chrome 等客户端浏览器显示不同类型的文件。 我让它适用于 txt 和 html 等文件,但我似乎无法让它适用于 png 文件。 当我连接到 http://localhost:10000/ 时,出现黑屏。 有时,我偶尔会在中心看到一个白色的小方块 ...
[英]knights tour code with recursion and backtracking
我最近被分配了骑士的巡回赛问题。 这是我的尝试: 我在其中应用了递归和回溯,但代码在到达 (4,2) 后崩溃,现在我认为这失败了,因为while循环似乎没有正常运行(它以某种方式终止) 但我不知道为什么..我一直被困在这个问题上并尝试了各种方法来调试这个请帮助我!! ...
[英]How to implement append method in our own shell using open system call in c?
我正在尝试实现我自己的 shell,其中我必须制作一个 shell 功能,通过该功能我可以使用 >> 将 append 文本写入文件。这是我的代码.... filedesc 总是返回 -1。 ...
[英]I'm not able to run c code in vs code terminal
当我尝试在 windows 11 中运行代码时,它在终端中显示此错误... 终端在行:1 字符:1 gcc 我-c cd "C: /MinGW/binc/Users/DELL/Desktop/C 编码/"; 如果($?) : ObjectNot Found: (C: \MinGw\binc\U ...
[英]Reading a matrix from a file in C, the file contains values and positions
嗨,我是 CS 学生,之前没有编程经验,我的老师给了我这个练习,其中包括阅读这样的文件:3 4 2 1 1 1 2 3 8 3 3 3和4是矩阵的行数和列数,然后是三个数字一组,第一个数字是值,其他数字是位置 I,J。 这是结果矩阵:2 0 0 0 0 0 1 0 0 0 8 0 这应该是矩阵 ...