Category "c"

When and why should I use void as the return type of a function in C?

I'm currently practising C and learning pointers and arrays. I watched a tutorial where the instructor changed the function from int aFunction() to void aFuncti

What happens to a declared, uninitialized variable in C? Does it have a value?

If in C I write: int num; Before I assign anything to num, is the value of num indeterminate?

Allegro 5 game - bitmap drawing slows down after running for a few seconds

I have a problem with my Allegro 5 code. It has three, sections, a section that checks for inputs, then a section that runs every 1/30th of a second with a time

How does the CPU cache affect the performance of a C program

I am trying to understand more about how CPU cache affects performance. As a simple test I am summing the values of the first column of a matrix with varying nu

MPI and MemoryLeaks and MPI_Wait() with async send and recv

I am new to MPI programming and I am trying to create a program that would perform 2-way communication between processes in a ring. I was getting MemoryLeaks er

I have a buffer overflow assignment like this, I set the correct varaible to the HEX value of 1 (31) and still nothing, how do I solve this

How do I set the value of correct to 1 with an buffer overflow exploit? When I pass nothing to this the value of temper is 4D2 which is hex for 1234, but when I

Linux Kernel Module never reaches ->probe() functions

Summary I want to write a simple Linux Kernel Module, which will initialize a GPIO from information it got from device tree. But currently my module never enter

Get this to buffer overflow / Finding Vulnerabilities

I have been set an assignment where I am to find vulnerabilities in the code however I don't seem to be able to find one. I am very new to C and have the basic

Keep k random strings from input file of unknown length in C

Problem I want to get input from a file of unknown length, separating the input to strings at a defined delimiter and saving some of them. After reading the ent

What does "%%%ds" mean in a c program formatting text?

This c code I wrote below to centre text in strings works. I cannot find an explanation of what "%%%ds" in the program means and how it works. There is d for in

Custom date and time including nanoseconds

For this program I need to "grab the start time of the entire process within the max. time precision avail including nanoseconds." in the format: April 9, 2022

Call a function using a pointer and pass it along in the parameters

Say that I have a pointer to function theFunc. theFunc takes along a pointer that points to the address where theFunc is stored . Is this possible? Using it wou

Wrong protobuf deserialization on ARMv7

Note: I am completely new to working with different cpu architectures and working with C / gcc I am trying to create an application written in plain C, which re

C program to remove consecutive repeated characters from string

The code: https://pastebin.com/nW6A49ck /* C program to remove consecutive repeated characters from string. */ #include <stdio.h> int main() { cha

Is it possible to destroy the memory via pointer?

First I promise that I won't do anything bad with this. I'm just curious. #include <stdlib.h> #include <stdio.h> int main(int argc, char ** argv) {

Is there a way to get win32 file handle from pipe's C file descriptor (python)?

Searched for about 1 hour and still unable to find any relevant search results. I want to wait on multiple pipes in a single thread, but unable to convert the f

Adding to list and displaying list functions in C

I have my linked list that I created. I made addToStart function which has2 paramters, first parameter is the head of the list, second parameter is the data to

how to test if a variable is valid or whether it is initialized or not in C?

I am learning C from scratch with Harvard's cs50 course. I've been given an array that's been initialized this way: int stuff[9][9]; now I have to handle it. I

Error building Delegate Proxy 9.9.13 using G++ 11.2.0

I applied the 2 patches mentioned by the original author of Delegate 9.9.13 but still encountered another build error as shown below. Could someone suggest a f

Casting function pointer arguments without a helper function

void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void *, const void*)) Is there a way to pass, let's say strcmp to qsort without making a