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.
405,473
questions
1
vote
0
answers
40
views
Can't understand this C syntax. Designated initialization of an array of structs?
Trying to learn the nuances of C, though I was doing well until I found this:
#define SOKOL_IMPL
#define SOKOL_GLES3
#include "sokol_gfx.h"
#include "sokol_log.h"
#include "...
0
votes
0
answers
7
views
Driver for a ADXL345, using an ATmega328p-pu and SPI communication, running it all bare metal
So as the title suggest im trying to make a driver for the ADXL345, for this project im using a ATMega328p-pu and the SPI communication protocol. Im running this all bare metal, so when i run my main....
0
votes
0
answers
10
views
MPI - One MPI_Send to multiple listeners
the thing is that I'm writting a programm in C using MPI. I the objective is to have N processes in the programme and once initiated one process send a token to a random different process, repeating ...
-6
votes
0
answers
38
views
Dynamic Programming in Leetcode [closed]
What questions can we do in Leetcode in dynamic programming for starters?
I want to know problems which can be solved using Dynamic programming in Leetcode which easy for a starter.
I've been ...
0
votes
1
answer
27
views
sqlite3_step() commits to database [closed]
I am attempting to run a sequence of sqlite3 prepared statements (some SELECT, some INSERT) and I want to be able to wrap them in a transaction, so if errors elsewhere in the code materialise, I can ...
1
vote
0
answers
19
views
Android Emulator detection is not working for some devices
I have a piece of native code with C in my Android project for detecting emulators. It works perfectly for detecting all Emulators but some real devices are detected as vulnerable too. How can I ...
-1
votes
1
answer
41
views
Can pthread_cond_wait() be called with read-write lock?
I know pthread_cond_wait() shall be used with mutex, but I'm curious if it can be used with rwlock.
I read manual page of pthread_cond_wait() and it didn't say anything about using read-write lock, ...
1
vote
0
answers
36
views
ASCII art with SDL2, an unexpected output
I wanted to create ASCII art using SDL2, but I don’t understand why I’m getting this result:program output](https://i.sstatic.net/1IUV743L.png) for the orginal image is](https://i.sstatic.net/ytrb2R0w....
-3
votes
0
answers
34
views
Is there a quantum computing library in C++ or C? Like cirq lib in Python [closed]
I would like to know if there is any library that is similar to cirq in C++.
Although I find python easy and not overwhelming, my main is c for many years, I would like to create circuits by c instead ...
1
vote
1
answer
32
views
_Generic Statement For An Enumerator (Enum)?
I frequently have to deal with the functionality of enums in C. However, there doesn't seem to be an easy & equally efficient way of supplying a different result based off of a predefined enum ...
-1
votes
2
answers
75
views
uint8_t elements exceeding one byte?
I saw this code:
uint8_t broadcastAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
I know uint8_t holds a byte, so how does this line of code work when a single
element, 0xFF, is in itself one whole ...
-5
votes
0
answers
35
views
How do i interact with an image in C [closed]
Ok so i wanted to write a program that could take an image check each individual pixel's color in a frame and assign it a greyscale number just by dividing the RGB value by 3. the problem is that i ...
1
vote
2
answers
56
views
Any one know how return 0 works or maybe any problem with devc++
im new at coding.
so right now im learning C and im using devc++.
but i don't know my program instantly close after i compile
#include <stdio.h>
int main() {
printf("hello");
...
2
votes
0
answers
27
views
How to take screenshot in gtk4?
I am trying to take a screenshot of the root window in gtk4. This is how I do it in gtk3--
GdkWindow *root_win = gdk_get_default_root_window();
gint width = gdk_window_get_width(root_win);
gint ...
1
vote
1
answer
46
views
Linking header file still leads to undefined reference
I have three files:
vector2d.h referencing my functions.
vector2d.c defining my functions.
test_vectors.c as the main file.
test_vectors.c doesn't build because it returns an undefined reference error ...