Category "c"

Does adding a star after a pointer struct definition make it a double pointer?

I have a struct typedef struct hash_entry_{ char *string; void *data; struct hash_entry *next; }hash_entry, *p_entry; I am referencing p_entry later i

Break down the logic for a C for-loop into something I can implement in MIPS? (count number occurrences in an array)

Hi all i am converting my C code to MIPS but problem is here i couldn't make correct logic for this for (int i=0;i<count;i++) { h[a[i]]++; } as

Is it possible to use Visual Studio 2022 Test Explorer to run C unit test?

I would like to run ansi C unit tests in VS by mean of Test Explorer (not only with Console). I saw that it's possible for C++ projects (https://docs.microsoft.

How to append to a zlib stream?

I have been trying to append raw bytes to an existing zlib stream using the deflatePrime function provided by the zlib library. However, i cannot understand wha

Is there a way to use the #define directive to create a constant struct?

Let's say I have this struct typedef struct { int AM; char* name, surname; }Item; and I want to define a constant NULLitem with AM = -1 and NULL name/

How to covert the address from KCOV output to filename:lineno using addr2line?

I want to use KCOV (code coverage for fuzzing) in the Linux kernel to record the coverage of certain system calls. I have enabled the corresponding kernel conf

C,Reading From File,Prinintg, Syntax Error identifier

Im trying to run my c code. but im getting a problem and really tried that much to get the right thing and i couldnt know what the problem. what is visual studi

How to I get my program to skip the uint32_t, then start reading the rest of the binary data into structs in C?

I have included my code below. I have it reading and printing the first line of a binary file. The rest of the file is meant to be put in a struct that contains

Making HTTPS requests from ESP32

I am making a post request from my ESP32 S2 Kaluga kit. I have tested the HTTP request while running a server program in my LAN. I am using esp_http_client_hand

Looking to use a library with example code for Open Quantum Safe

So I am trying to use following library: Open Quantum Safe I am using windows linux subsystem, so I followed the linux setup. I think I followed all the steps c

how to convert int to void *?

I'm trying to make an analogue of sscanf with a specifier %p. I use this: int res = ahex2num(buf); *va_arg(ap, void **) = (void *) res; It works correctly, i a

why child can't send signal to parent

parent: volatile int signalval = 0; void signal_handle_c(int sig_num) { printf("child SIGUSR1 ok\n"); signalval = 1; }; int main(int argc,char**argv){

Openssl 3.0. Rsa private methods not called

Recently I have migrated my app from OpenSSL 1.0 to OpenSSL 3.0. And now my connection is not working anymore. The methods which perform private encryption and

How to call a C function from Java 17 using JEP 412: Foreign Function & Memory API

Does anybody have a simple example on how to call a C function from Java 17 that includes creating a C library and how to setup a MethodHandle? The JEP descript

Why is the XOR swap optimized into a normal swap using the MOV instruction?

While testing things around Compiler Explorer, I tried out the following overflow-free function for calculating the average of 2 unsigned 32-bit integers: uint3

Thread safe random number generator in c

Does the c standard provide a thread safe random number generator where instead of using a global state the generator uses and modifies the provided state buffe

C : why is that cast of void function to "pointer to function returning pointer to pointer to void" possible

#include <stdio.h> void hello() { printf("hello world\n"); } int main() { void *(*gibberish)() = (void *(*)())hello; (*gibberish)(); voi

What calling convention does printf() in C use?

So I've been practicing to write simple subroutines in FASMW using the CDECL and STDCALL calling conventions and it got me wondering about what the printf funct

Returning dynamic memory inside a struct in C

Hi I have the following struct typedef struct mystruct_s { int* array; } mystruct; and I want to create a function that initializes it. I have two ways of

Trouble passing a C# string from userland to kernelmode C and using it to find specific LDR_DATA_TABLE_ENTRY

I am having difficulty comparing a string passed from usermode type LPWSTR to a LDR table entry type UNICODE_STRING Kernel C: struct { int pid; int user