Category "dynamic-memory-allocation"

Returning dynamic memory inside a struct in C

Hi I have the following struct typedef struct mystruct_s { int* array; } mystruct; and I want to create a function that initializes it. I have two ways of

How to use dynamic 2d array inside a struct array in C?

What do I want to do? I'm working on a project on dynamic matrix multiplication. I want to input from the user that on how many matrices, he/she wants to perfor

C++ Read txt and put each line into Dynamic Array

I am trying to read input.txt file, and trying to put each line into the array as string (later on I will use each element of array in initializing obj that's w

XINU OS - Understanding roundmb function

I am studying XINU OS, and came across this simple one-line function. Is it possible to explain how this function is working and rounding x to nearest block siz