Questions tagged [c]
Programming questions are off-topic here. Do not ask questions about how to write code in C. However, conceptual questions about computer science are more appropriate. See our help center for the scope of this site.
110 questions
1
vote
1
answer
146
views
How to model adversarial moves (e.g. chess) with Boolean Satisfiability?
I'm trying to solve the game of chess with a Boolean Satisfiability Sovler. For that, I implement a C/C++ program with some non-deterministic values, convert this program to a Boolean Formula (CNF) ...
0
votes
2
answers
74
views
On a micro-architectural level, why is using a temporary variable faster than using XOR to swap two variables?
I've done some very basic bench marking for the following:
...
3
votes
0
answers
88
views
What algorithm can be used to implement code folding for the C programming language?
I'm working on a simple editor for the C programming language (without using an AST), and I need to implement a code folding feature.
When the user opens a file, an initial parse is performed, and all ...
0
votes
1
answer
105
views
Books for Design Principles Behind C
I'd like to learn more about the finer design principles and choices in the development of C (i.e., of C itself, not using C). Any standard of C (and ideally libc too) will do, though K&R C would ...
0
votes
0
answers
37
views
I cant understand memory references in memory trace of valgrind with lackey
i am executing this command on terminal
valgrind --tool=lackey --trace-mem=yes ls 2> trace.txt
looking at some of the memory trace
...
0
votes
1
answer
93
views
Construct a simple iterative C program to generate a given character sequence
I’ve been reading about PRNGs like LCGs and their derivatives. This got me thinking; what if I wanted to go backwards, coming up with a recurrence relation given a particular sequence of numbers. Say ...
1
vote
1
answer
213
views
Accessing out of bounds indexes on an array in C
I am trying to figure out how to apply the Sobel edge detection for a BMP image, which is a 2D array of BYTE values. When multiplying a pixel by the GX or GY kernel, if the pixel is on the edge of the ...
-5
votes
2
answers
218
views
Are my ideas good enough to be hired by programming design groups?
Am I having any chance if I implement a system programming from scratch? I have some ideas. The first is to fix malloc in C. Add a last parameter to all function calls, use LINE and ThreadId and make ...
0
votes
1
answer
182
views
Selection sort on the array $\{5,9,11,10,2\}$
I want to understand how the algorithm of selection sort sorts the given array,
$$A[5]=\{5,9,11,10,2\}$$
Step -$1:-$
I compare A[0] with remaining elements of the array and since $A[4]<A[0]$ I swap ...
3
votes
4
answers
382
views
Are float pseudo-random number generators always implemented using integer generators underneath
In C it's well known to use simple routine for turning integer rng into float rng. Something like that
...
2
votes
1
answer
208
views
1
vote
0
answers
314
views
Oldest Operating System still in use today?
Reading through https://en.wikipedia.org/wiki/Timeline_of_operating_systems to decide where to port some library software—network|crypto|archive abstracting—I'm writing in C (C89).
DOS is definitely ...
0
votes
1
answer
166
views
How do you tell whether a binary number is positive or negative?
Consider the figure in Exercise 2.
If the current machine code that executes is 0x214bfffd and the values of the registers
in the processor are as shown below, what is then the value of the input WD3 ?...
1
vote
0
answers
64
views
How do i make a 2d array as same as i possibly can with another one?
Say i have an 2d array A of nxn size, int values already given for each item.these values can be the same or different.
There's gonna be another nxn array B being input.
I can only interchange one row ...
0
votes
1
answer
83
views
What is the reason or advantage of having special purpose status flags for the result of comparisons? [duplicate]
The C semantics treat the result of a comparison or any true/false operation as just an int ...