Category "c"

I'm trying to create a stack in c using structures but my push function doesn't work

I'm trying to create a stack in C using structures but the push() function I wrote is acting strangely. I'm sure it is something obvious that I'm missing but I

VS Code Mac m1 Debug is not hitting my breakpoints with Makefile conf C language

Hello ! I'm new with using VS Code while programming in C language and I'm trying to debug my program with the "Makefile Tools" plugin but it doesn't seem to co

quicksort with partition using linked list

I try to implement quicksort with partition using linked list. I did it few times with regular array and I got the idea well, but with linked list it is really

Is there any way to print list of runnable tasks on the per cpu runqueue, without using for_each_process_thread()

Note: cat /proc/sched_debug //It prints percpu runque list source path: kernel/sched/debug.c There is a way which available in Linux kernel to print runque tas

No output from iosnoop (dtrace) until application is killed

I want to understand iosnoop. Therefor I wrote a small program to trace on. I expect to see something in iosnoop if I flush the cache. I don't see anything unti

How can I compute a very big digit number like (1000 digits ) in c , and print it out using array

how to print a number in C with 1000 digits same as 31000 ? using arr[1000], every position in the arr gets a digit. void main() { unsigned int Base, Power

How to stop the execution of a running code in x11

I have a program that draws on a x11 window and I'd like to quit it as soon as I press any key. With the code I have, I cannot stop the program with a keypress

calculating the amount of cupcakes per person

#include <stdio.h> int main() { int c,peo,pie,rem_pie; pie = (int) c/peo; rem_pie = (int) c%peo; printf("Enter number of cupcakes:");

No content using fputc

I am attempting to complete a lab. When I run this code nothing is written to the text file that is created. According to the lab it should write A thru Z to th

Complex keyboard input to child process in C, Linux

Ive been trying to solve this one for some time but im unable to come up with a solution. I need a child process to understand complex WASD keyboard input (with

Moore-Penrose Pseudoinverse of matrix using Singular Value Decomposition

I am trying to compute the pseudoinverse of a matrix in C code. Specifically, I am trying to compute the Moore-Penrose pseudoinverse using singular value decomp

Is it possible to enter single bytes in C through terminal?

I have a fragment of code where something like this happens: char buf_path[0x100]; *len = fs->read(0, buf_path, 0x1000); What I want to do is to enter two N

save stderr with _popen to a variable in C on Windows 10

When I use something like char result[1000] = ""; char psBuffer[1000]; FILE* pPipe = _popen(command, "rt"); while(fgets(psBuffer, 1000, pPipe) != NULL) { st

Can't assign value to a struct field

Why does the following code: struct number { int num1; int num2; } arr[5]; arr[0].num1 = 1; int main() { return 0; } produces: main.c:8:8: error:

PIC16F15257 ISSUE with different output pin voltages

Anyone have an idea as to why a pic will have very different output voltages on certain pins ?? I use multiple outputs on one switch and sometimes the one pin w

Disable Rule 2.2 checker

My shop is using Coverity 2019.3. We have MISRA-C 2004 enabled. I want to disable MISRA-C 2004 Rule 2.2: Source code shall only use /* ... */ comments. The cov-

How MQTT QoS token work in Paho MQTT C code?

I have a difficult to understand how token QoS work in Paho MQTT C code. My idea is that I want to read the PUBACK when using the QoS =1, for publisher to know

How to make CLion work with subdirectories

I'm currently a student and need to learn C. I'm working on a Debian Virtual Machine using CLion. To manage my assignments better, I created a github repository

Why doesn't my multi-process writing program trigger concurrent conflict?

I'm trying to trigger some concurrent conflicts by having several processes writing to the same file, but couldn't: #include <stdio.h> #include <stdlib

ECCODES build on Windows 11 fails on Generate step

I'm trying to build ECCODES C package (https://confluence.ecmwf.int/display/ECC/ecCodes+installation) on Windows 11 for further usage with python pygrib library