Category "c"

Makefile with arbitrarily many mains. How to compile all mains with one command?

I am still newish to makefile patterns. I have been working on a project based on a template makefile and project structure, however I have a good sense of what

How to represent sparse matrix (including zero elements) in C using linked list?

I want a code that represents a sparse matrix including zero elements using linked list, I basically want the output to be like this: 1 0 0 0 0 6 1 0

Encrypting a video file with the 3DES algorithm

I am encrypting a video file using 3DES algorithm and ffmpeg library.In my program, I use two channels, each connected to its own instance of FFmpeg. Basically,

fread a float array after a fwrite immediately will cause a file offset problem

Initial the integer array[] right line 21 will cause the failure of the data[] array fread from data.txt . int main() { FILE * file0 = NULL;

Why is my print function giving the wrong output in my program to print strings?

The expected outcome is for example: a word a sentence This is the outcome tho: aword word a sentence Here's the code: #include <stdlib.h> #include <

Why Segmentation Fault for this below code? [duplicate]

This following code gives Segmentation fault: #include <stdio.h> int main() { char* str = "hello world"; str[0] = 'H'; // it is

initialization of 'const char **' from incompatible pointer type 'char *'

I am new in learning C. I have an issue in returning double star pointer from the function. This is my code. #include <stdio.h> #include <stdbool.h>

Are "thread storage duration" and "thread local storage duration" the synonyms?

C11, 6.2.4 Storage durations of objects, 4 (emphasis added): An object whose identifier is declared with the storage-class specifier _Thread_local has thread s

Is this defining the struct pointer address?

I am a bit lost in the following piece of code. What does it mean? Define the the Elf pointer start position? #define ELFHDR ((struct Elf *) 0x10000) Aft

Unexpected output when printing to 0xb8000 - osdev

I'm developing a kernel and when I try to print to video memory(0xb8000) I get weird characters when I run it. What I have tried: I have tried to find some answ

Remove an element from array of structs with pointers

I have to implement the appointmentData_remove function which removes an element of type tAppointment from the tAppointmentData array. Data types are defined li

Getting a stack overflow exception when declaring a large array

The following code is generating a stack overflow error for me int main(int argc, char* argv[]) { int sieve[2000000]; return 0; } How do I get around

Eclipse throwing "Unresolved inclusion error" on standard includes like "stdio.h"

After installing Eclipse freshly on Windows 10, I imported code to work on, but Eclipse started throwing the error "Unresolved inclusion error" on standard libr

Compile all C files in all of the children directories

So, I'm making a game with raylib and I need to compile all the .c files at once. The files are in separate folder inside the 1st one(Like "MainFolder/PlayerFil

Called function work at printf but not at arithmetic statement

I made a struct Triangle and I made a function to calculate p(perimeter/2). When I call the function inside printf it works. But when I call the same function a

I can't get an application to run on Windows startup ASM (Registry)

I am trying to translate a code made in C into assembly (FASM) but I can't get it to work. The code tries to create an entry in the registry so that when the ma

How to use unpacked data msgpack-c

I know how to unpack data but don't know how to use specific data from array or map, Here's the code : #include <msgpack.h> #include <stdio.h> int

Using cblas_dgemm in C and returning the product matrix in python

I am fairly new to parallel computing and we have been assigned to implement a matrix algorithm in C for later use in python. The problem comes when my function

How to link a objective-c library into a c/c++ project

I have this code: for the objective-c library GNUmakefile include $(GNUSTEP_MAKEFILES)/common.make LIBRARY_NAME = libteste libteste_OBJC_FILES = ./src/teste.m

Make Fread run until there's not enough bytes

So what im asking is how to make fread function loop until left with not enough bytes to look at. Is this okay? : while(fread(buffer, 512, 1, image)) == 512 );