编程笔记

  • 关于 malloc:C – 设计自己的 free() 函数

    C - Design your own free( ) function 今天我去面试,面试官问我这个, Tell me the steps how will you design your own free( ) function for deallocate the allocated memory. How can it be more efficient t…

    编程笔记 2022年6月21日
  • 关于C#:尝试使用pthread实现竞态条件

    Trying to implement race condition using pthread 我正在尝试设置比赛条件,以了解它是如何发生的。我写了下面的代码。这编译没有任何问题,但是当我运行它时,它不会在每次运行时打印计数。如果运行两次或三次,…

    编程笔记 2022年6月21日
  • 关于c:stdatomic(C11),关于_Atomic类型的三个问题

    stdatomic (C11), three questions about _Atomic types 第一个问题 我在 cppreference 上找到的 _Atomic ( type-name )(自 C11 起) 用作类型说明符;这指定了一个新的原子类型 _Atomic type-name (2)(C11 起) 用作…

    编程笔记 2022年6月21日
  • 关于 c:sprintf 导致我的程序在 keil 中停止工作

    sprintf cause my program stop working in keil 这是我的主要功能,我不知道为什么当我在 proteos 中模拟它时,我发现代码运行到 sprintf 并且下一行没有运行,当我评论它时"salam"印刷在液晶显示器上我使用 mingw…

    编程笔记 2022年6月21日
  • 关于C#:getc是宏还是函数?

    Is getc a macro or a function? 我试图找出getc 和fgetc 之间的区别。当时我看到这样的说法: The difference between getc and fgetc is that getc can be implemented as a macro, whereas fgetc cannot be impl…

    编程笔记 2022年6月21日
  • 关于 c:Server 无法接受来自多个客户端的消息?

    Server is not able to accept() messages from multiple clients? 两个客户端能够连接到服务器,但它只接受和显示第一个客户端的输入流消息,而不是第二个客户端,尽管另一个客户端也已连接。 以下是我接受流的代…

    编程笔记 2022年6月21日
  • 关于 c:Openssl 编译错误

    Openssl compile error 我使用 openssl 库在 C 代码中包含以下头文件。 1234567891011121314151617181920 #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include #i…

    编程笔记 2022年6月21日
  • 如何使用 EXECL 从 C 代码执行 Python 脚本?

    How to execute Python script from C code using EXECL? 我想知道如何使用 execl(或类似的)从我的 C 代码中执行 Python(或 Lua 等)脚本? 以下是一些"父/子"代码,显示了我如何使用 PIPES 将数据流发送给孩子。代…

    编程笔记 2022年6月21日
  • 关于 c:pthread 返回例程

    pthread returning routine 我的例程必须有一个返回值并且需要返回。 即: 1 int mySuperThread(void) 我启动线程,它会做它需要做的事情。被问到的问题是如何不断地一次又一次地重新启动线程来完成它的工…

    编程笔记 2022年6月21日
  • 关于 c:pthread_join 返回一个 NULL 地址

    pthread_join returns a NULL address 我是 C 线程编程的新手。我在下面尝试了一个简单的程序。 123456789101112131415161718192021 #include<stdio.h> #include<pthread.h> void* func(void* arg&…

    编程笔记 2022年6月21日