Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
4 votes
5 answers
262 views

I have the following code snippet in C that declares multiple one-dimensional and two-dimensional arrays of type double. double func(double alphas[], double betas[], double rhos[], double **X, ...
0 votes
0 answers
31 views

I am working on an application (Linux based) that uses AES-256 encryption and observed a significant increase in RAM usage during encryption. Initially, the process consumes about 3 MB of RAM (checked ...
1 vote
3 answers
141 views

I have a struct like this: struct state { bool isfinal; bool *isfull; char **board; }; isfull is an array and board is a 2D array. I can allocate memory for the arrays with this function: ...
-2 votes
2 answers
158 views

Well, I want a function like memset but for struct, so that it can be used on some or all elements, like this: // create array of person data elements struct { unsigned char name[25]; unsigned ...
M 027's user avatar
  • 339
2 votes
1 answer
181 views

I was doing this leetcode problem and I had to initialize a very large 2D DP array of size 2^14 x 14 with all entries set to -1 to solve the problem. However I noticed a big performance difference ...
N_ E's user avatar
  • 61
-2 votes
1 answer
519 views

Can anyone tell me the difference between memset() and std::fill() in c++? I am quite confused why my code doesn't work with memset() but does with std::fill(). I am making a Sieve of Eratosthenes ...
mya's user avatar
  • 1
3 votes
1 answer
192 views

For a project to learn C, I decided for fun to put the code in Compiler Explorer and compare the assembly output with the C code. Here's a minimal example of some code unsigned char count[256][256]; ...
qwr's user avatar
  • 11.6k
0 votes
0 answers
90 views

I'm having trouble using memset() in C; let me explain. I'm working with embedded Linux on a zynq ultrascale+ board running Linux kernel v4.14. I'm performing some DMA transfers from the logic side of ...
0 votes
0 answers
339 views

I wrote a very simple test program in the application layer. First, I open the PCIe device, then mmap() the starting space of the PCIe BAR. Finally, I use the address returned by mmap(), apply an ...
0 votes
1 answer
145 views

The scenario is one process writes the program metric stats data to shared memory file.And another process will read the file and send the data to metric server. The bus error and core dump occurs in ...
-1 votes
2 answers
127 views

I have a 2D array set as long long arr[500][500] Running this main function, I get different values for m=-1 and m=-3: int main(){ memset(arr,m,sizeof(arr)); for(int i=0;i<10;i++) ...
underdog's user avatar
1 vote
2 answers
214 views

I have bool array and I want initialize all elements to false. What is the correct way using memset. I see these examples on stackoverflow: bool arr[10]; memset(arr,0,sizeof(arr)); and bool arr[10]; ...
5 votes
1 answer
233 views

It is not very rare to find a library that zeros its objects in the constructors using memset. And sometimes it happens to empty classes as well. Is it safe, especially when one inherits such classes? ...
2 votes
1 answer
732 views

Let's say I have a struct Foo s. t. struct alignas(64) Foo { std::atomic<int> value; Foo* other; }; Then, if I have an array Foo array[2048]; of Foo's: I already have initialized the ...
1 vote
0 answers
186 views

When built without AM_CXXFLAGS += -Wno-memset-elt-size on the AutoMake Makefile, i get this error: error: ‘memset’ used with length equal to number of elements without multiplication by element size [-...

15 30 50 per page
1
2 3 4 5
...
35

AltStyle によって変換されたページ (->オリジナル) /