Category "c"

Is it right to implement queue with single linked list?

My Code ↓ Some macros defined by #include <stdio.h> #include <malloc.h> #define ElementType int #define ERROR 0 // 队列ஷ

Deleting node in list

*x = L->list[i]; /* Save the deleted element to parameter x */ for(j = i+1; j <= L->size-1; j++) L->list[i] = L->list[i+1]; L->size--;

GtkTreeView: Show all columns

How can I show all the columns of my treeview at my application startup. My treeview has multiple columns: gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_

Rebuild QEMU (For RISCV-GNU-TOOLCHAIN)

This is a follow-up from the following question Custom Instruction crashing with SIGNAL 4 (Illegal Instruction): RISC-V (32) GNU-Toolchain with QEMU (apologies

How do you check if an arithmetic operation will overflow?

I am coming from looking at Rust and How do I detect unsigned integer multiply overflow? where in Rust they have checked_add, which is implemented like this: pu

macOS llvm can't find stdio.h anymore

I come to you with a weird problem I've been facing. So last week, I installed llvm and libomp for a C project, and it compiled just fine with this at the start

Print greek characters in CLion IDE

OS - Windows 8.1 IDE - CLion 2021.3.2 I need to print some greek characters but what I have is these symbols: ╬╗ , ╬╝ , ¤ü

What does atof stand for?

In C atof=a-to-f(loat) converts a string into a double precision float. I am wondering what the a part of atof stand for.

Organise multiple fixed-length-string dictionaries for "sparse" string-lengths

I need to load some fixed-length-string dictionaries from disk: count of word-lengths ( 1 .. 18 ), word-lengths ( 3 .. 20 ), word-counts ( 1 .. N ) for each wor

Pass linked list to function with struct what I doing wrong?

I want to pass liked list to function and create new list. I need some help to understand what I'm doing wrong. I create new pointer and copy the pointer to "cu

Shared pthread_cond_broadcast stuck in futex_wait

I have one "server" process a and potentially multiple "client" processes b. The server creates a shared memory file (shm_open) containing a pthread_mutex_t and

Cython: Assign pointer values, not the pointer itself

C/C++ allows assigning values of a pointer to another pointer of the same type: #include <iostream> using namespace std; int main() { int* a = new i

Using qsort to sort a multidimensional array of variable-length strings in C

I have a piece of software that generates a rather large text file full of information about files in a directory. There are often several thousand files. Each

why the output is blank?

I have to write a program for matrix multiplication.there may be an easier algorithm,but i want to know what is the problem here and if there is anything wrong

What is a glibc free/malloc/realloc invalid next size/invalid pointer error and how to fix it?

You are most likely seeing this question because your question has been closed as a duplicate of this. For a moderately complete list of related questions, ple

Forward traffic via libnetfilter_queue

I have a need where i need to forward traffic with libnetfilter_queue to another server, after adding some informations in it. Problem is that i'm stuck on the

C language: main .obj file (and executable) is nearly 400MB in size

Dependencies: GLFW 3.3.7 GLAD 4.0 core CGLM 0.8.5 stb_image 2.2.7 Compiler: GCC 11.2.0 (MinGW-W64) CMake 3.23.1 GNU Make 4.3 Problem The .obj file for main.c (a

How to increment %eax register and output in a c callable function?

#include <stdio.h> extern int count(char *string, char c); int main(void) { char s[100]; char c; printf("Enter a string of characters:\n"); scanf

Can floats not suport negative or even 0?

It's follow-up question to: How to detect non IEEE-754 float, and how to use them? In theory, can we assume that c float always support negative numbers?

Intermittent SIGBUS on shared memory segment

I have a server process that allocates a big chunk of memory using the System V XSI shared memory calls (shmget/shmat), from address to 0x500000000 to 0x1d00000