Questions tagged [c]
C is a general-purpose programming language used for system programming (OS and embedded), libraries, games, and cross-platform. This tag should be used with general questions concerning the C language, as defined in the ISO 9899 standard (the latest version, 9899:2018, unless otherwise specified — also tag version-specific requests with c89, c99, c11, etc.). C is distinct from C++, and it should not be combined with the C++ tag without a specific reason.
167
questions
0
votes
0
answers
6
views
LNK2019 unresolved external symbol in function defined in static library
I am trying to compile a driver through the use of cl.exe on Windows 10. It is written in pure C. I am using the Enterprise Windows Driver Kit to provide source files and compiling for X86. I ...
0
votes
0
answers
19
views
In C language, do multiple implicit conversions that occur in an expression have a certain order?
(My question might be quite long. I would be very grateful if you could read it through.)
I am learning C language by reading the C11 standard. I find that there are quite a lot of implicit ...
0
votes
0
answers
22
views
How can i use functions from libc in NASM 64 bit
im making my own programming language and i wanted to call some functions from libc (es strcat and printf) but im unsure on how to call them correctly(i dont which cpu registry to use and if i have to ...
0
votes
0
answers
9
views
Receiving and Sending J1939 CAN message on Linux in C
I am trying to open a SocketCAN J1939 and receive and send J1939 messages. I am very confused with type "sockaddr_can". This structure has j1939.addr, j1939.pgn, j1939.name etc. When I ...
0
votes
1
answer
46
views
Passing `volatile` buffers to library functions which do not take `volatile`
I have a multi-processor system with a "shared" memory region used for communication. In some cases one of the processors needs to process some considerably large data in the shared memory ...
2
votes
0
answers
55
views
malloc fails even with enough memory
I'm implementing a SkipList for academic purposes in C.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// ===============================================
// SkipList
// ===...
0
votes
0
answers
32
views
Unable to access server running in k8s pod from WSL host with docker-desktop installation
I'm running docker-desktop with WSL2.0 ubuntu on windows. I created a k8s deployment in the wsl ubuntu host. The deployment has one pod where I'm running a simple server program(runs forever, accepts ...
0
votes
0
answers
38
views
Adding attributes to entire c-file instead of specific function
Hi I was trying to add the attribute __attribute__((section(".protected"))) to my whole c file. My temporary solution was to just give this attribute to main() and put all the variables ...
1
vote
1
answer
36
views
iconv: Invalid argument error when passing struct element
I have a function which converts utf-16 string to utf-8 by using iconv library (ignore "ISO-8859-1" part, my test files all are utf-8 and utf-16). Here is it's code:
char* to_utf8(const ...
3
votes
1
answer
44
views
In R, how and where does the underlying C functions get their argument inputs?
I'm trying to understand what happens at the C level when I call a function in R. For instance, print("Hello, World!") will call UseMethod("print"). From the "table" in ...
0
votes
0
answers
30
views
TCC & CLion errors
I've setup successfully the CLion + TCC enviroment on the windows 10 machine. My colleague asked me for help with that so I shared the CLion project and he:
unpacked the TCC in the right directory,
...
0
votes
0
answers
36
views
How to handle error creating threads in a loop
I'm into the Philosophers project, it is about handling threads and mutexes. For the project I need to create several threads, each thread runs a routine function and accesses shared resources. I ...
1
vote
0
answers
51
views
C serial communication, Why does read() lose some data bytes at high baud rates (e.g., B921600)?
Question:
I am implementing a C program to communicate between two serial ports on the same machine. The setup involves two serial ports connected via a Null Modem adapter, and I am experiencing an ...
0
votes
0
answers
44
views
How do I properly call OpenGL 3.3 functions in Fortran?
For some reason, I am trying to run OpenGL 3.3 in Fortran. I'm having trouble calling glGenBuffers().
Note that glewInit() returns 1. I tried to set the glewExperimental = 1 flag, but with no ...
0
votes
1
answer
24
views
problem with cs50 p-set3 runoff (print winner funtion)
so this is a problem from CS50 Week 3 runoff, when I am running this code I am getting the following error, I cant understand why?
I don't find any problem with the code, so need help from more ...