Category "c"

Is there a way of "extracting" communication protocol from an old software?

I have an obsolete hardware level/pressure transmitter that communicate with mcu using custom protocol (it appear to be similar to modbus RTU), that hardware co

How do i copy n characters for m lines in a file (in c)?

I have a file of 1000 lines with up to 70 characters in them. I want to copy the 13 first in a table, the 15th-30th in another table... i tried many different t

Memory management and overflow in C

I always wonder why C manages the memory the way it does. Take a look at the following codes: int main(){ int x = 10000000000; printf("%d", x); } Of co

VSCode C/C++ IntelliSense ignore patterns for includePath and browse.path

Is there a feature in VSCode IntelliSense that allows to ignore specific header files for includePath and browse.path settings? In my case I have a CMake based

Why do C compilers prepend underscores to external names?

I've been working in C for so long that the fact that compilers typically add an underscore to the start of an extern is just understood... However, another SO

Beginner to C Programming - .c file that will operate outside of console / terminal and interact with GUI?

I'm several months into learning C programming and so far have used .c files that always output to the console. Can someone suggest a sample .c file with code t

How do i convert for loop to while loop in c language?

#include<stdio.h> int main(){ int i,j,rows; printf("Input number of rows : "); scanf("%d",&rows); for (i=1;i<=rows;i++) { for (j=1;j<

CUDA Memory Allocation for AoS inside a SoA

i've been working in a program that requires to use array of structs inside another array of structs or structure of arrays, i decided to use this approach give

Why are these constructs using pre and post-increment undefined behavior?

#include <stdio.h> int main(void) { int i = 0; i = i++ + ++i; printf("%d\n", i); // 3 i = 1; i = (i++); printf("%d\n", i); // 2 Should

I want to run two functions simultaneously on AVR microcontroller. Is there any method to do so?

int main(void) { DDRC = DDRC | (1<<2); DDRC = DDRC | (1<<3); while (1) { //openSolenoidValves(100,60); //startStep

fatal error: GLFW/glfw3.h: No such file or directory

when I try to import GLFW I get an error in VSCode saying "fatal error: GLFW/glfw3.h: No such file or directory". I read some articles about this error but coul

How to know when a char* library function arg needs an array it can modify, not a char pointer

I am new to C programming. and I know char * and char[] array are different. Yet, you can deduct the char[] to char * when it comes to a function param. So func

How to calculate minimum number of operations to make a number divisible by another

I have a coding prompt I am trying to solve: You are given two positive integers a and b. In one move you can increase a by 1 (replace a with a+1). Your task i

idevicedebugserverproxy: Immediate debugserver connection closed

after solving my previous problem in Unable to mount a developer disk image. iOS 15.4.1 - Xcode 13.3.1 (13E500a) , I encountered a new one. As mentioned in my p

how to convert a keypad input to time? [closed]

so I'm working on a project where it's required to take a key pad input from the user, display it on an LCD, and then start a countdown accord

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