Category "c"

Why does it iterate one more time even if it is NULL?

Similar question here . What I want to understand is that when current_node is NULL, the compiler doesn't see it as NULL and iterates one more time. void pr

writing to FILE for transmission over USART

I have a bit of code written by someone else that I'm trying to understand. I'm familiar with c enough to make basic/intermediate functions, but never really le

How to do multiple aio_writes to file

When doing multiple aio_writes to file is it necessary to wait (e.g. aio_suspend or other) before starting the next one? From the documentation it says that wri

How are char arrays / strings stored in binary files?

When I compile this code using different compilers and inspect the output in a hex editor I am expecting to find the string "Nancy" somewhere. #include <stdi

Seven segment project using atmega16 and external interrupts

I have been working on a simple project on AVR microcontroller atmega16 on proteus simulation. The project is: When I push the push button it increments the sev

Don't understand OpenSSL API error handling

I'm implementing a little HTTP client using OpenSSL, and I'm trying to handle "connection timed out" errors gracefully. By gracefully, I mean I want to print a

How to construct a string where every char is doubled?

TL;DR: I am asking you to tell me what would be the most efficient approach to double my strings and print them out? Full story: I had trouble with the title,

Epoll_wait() Does Not Recognize Client

I tried to make a simple server-client protocol where the server sends a set of fragmented files to clients, each client gets a fragmented file. I ran into an i

Pointers - Strings

I have a code chunk which is quite meaningless for me. Is there someone can explain it to me? Thanks int strLength(char *str) { char *p = str; // Go until the e

Programming STM32H747 ADC in continuous mode using registers only

Within a project of mine I use DMA to share data between the two cores of the STM32H747, the data comes from an ADC controlled by the core M7. While testing my

In C, I'm having trouble getting an Index sorted High to Low and vice versa

I'm working on a project involving a preset array: primaryArray[8] = {8, 4, 2, 16, 32, 124, 64, 256}; Im calling a function before the main, its not quite worki

Removing trailing newline character from fgets() input

I am trying to get some data from the user and send it to another function in gcc. The code is something like this. printf("Enter your Name: "); if (!(fgets(Na

Gauss-seidel method algorithm code giving inf numbers in solution

I'm not sure why I'm getting inf values when plugging in a 3 equation answer, another set of eyes on the equation loop would be useful, when I use a single equa

Stm32 optimization exercise

I am writing a program to turn on leds on a stm 32 board (model KAmeleon-STM32L496ZGT6). I have LEDs 7 6 5 4 3 2 1 0 When I run the program it goes from 0 to 7

problem in using fprintf_s(getting warnings) in c

I'm new in c.I just want to complete my project.a list of student with struct.and one of the option is save data in a file. I using visual studio 2022 and BTW I

Encryption Strategy for Flashing or updating firmware on ARM Cortex M0+

I want to flash a firmware update through CAN, on my ARM Cortex M0+ MCU. I'm using MKV11 microcontroller. How can I secure the firmware, so that, even if the tr

VSCode C/C++ IntelliSense automatic opening brackets

I'm coding in VSCode and while it isn't really necessary, sometimes i would find it useful if auto completion would add an opening bracket when for example auto

VSCode C/C++ IntelliSense automatic opening brackets

I'm coding in VSCode and while it isn't really necessary, sometimes i would find it useful if auto completion would add an opening bracket when for example auto

Can i use interrupts in inline assembly

I want to use interrupts in inline asm but it is not letting me I think my app is this __asm__("movb %ah,9;" "movb %al,0x41;" "movb %bh,0x0;" "movw %cx,0x1;

How to work with Ukrainian (or Russian) letters in C language?

Good day to all)) The task is as follows: "Enter the entered Ukrainian (or Russian) sentences into a singly linked list organized as a queue (only addresses sho