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.
24
questions with no upvoted or accepted answers
5
votes
0
answers
354
views
Dennis Ritchie citation for "the C declarator syntax is an experiment that failed"?
I've often heard that the C declarator syntax described as "an experiment that failed." I've seen claims that this sentiment is also shared by its creator Dennis Ritchie. Does anybody have an actual ...
2
votes
0
answers
2k
views
What assigns the physical addresses to variables?
Earlier I was having a technical test when I stumbled across this question:
I know that probably in modern systems, the OS and the MMU is responsible for that. But the test was focused on Embedded ...
1
vote
0
answers
110
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 ...
1
vote
0
answers
40
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 ...
1
vote
0
answers
30
views
Shell algorithm knuth sequence time complexity analysis
Given this shell sort algorithm implementation:
...
1
vote
0
answers
38
views
How to decide row / column strides for a loop over a matrix get these cache hit rates?
Given CPU with:
L1 cache: 4-ways, block size = 32 bytes , cache size = 64KB , LRU (Cache replacement policy).
L2 cache: 2-ways, block size = 32 bytes , cache size = 512KB , LRU (Cache replacement ...
1
vote
2
answers
453
views
Find offset and page number given paged virtual memory address
I ran into this question in class:
Assume a machine that is 64-bit and has 8GB memory. They use a paged virtual memory where the page size is 4KB. You run the following program:
...
1
vote
0
answers
30
views
1
vote
0
answers
48
views
Design considerations of datatypes in early programming languages like C
Although type theory originated (e.g. already discussed by Russell in 1910s) much earlier than programming languages, I have this feeling that languages such as C considered type-checking from a very ...
1
vote
0
answers
79
views
Why the name static and dynamic in static and dynamic scoping
I am wondering, from where static and dynamic scoping got their names.
After understanding the concept of static and dynamic scoping in C, what I assume is that whenever we failed to find out the ...
1
vote
0
answers
1k
views
trying to understand the diagonal check of 8 queen problem
I was solving the 8 queen problem and tried to look through the internet for comparison solutions to see how my solutions compared to others. I found one very small bruteforce solution that confused ...
0
votes
1
answer
31
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 ...
0
votes
0
answers
49
views
I want to get into Operating Systems, where do I start?
I have been doing web/app development for a few years, primarily involving high-level programming and stuff. However, I am interested in jumping into some low-level stuff and genuinely understanding ...
0
votes
0
answers
23
views
Problems with writing short job first algorithm(for scheduling of processes) in C language
Hy everyone.
I'm trying to write the SJF (short job first) algorithm NON-PREEMPTIVE for scheduling processes in C. I want to implement an algorithm that orders some processes by the burst of the ...
0
votes
0
answers
28
views
How to merge both, mutable and immutable worlds?
In the ideal world, systems are designed using immutable data structures. However, when you dive deeper into lower levels of abstractions, you realize that at some point a library written in C is ...
0
votes
0
answers
41
views
How to calculate how many times a function inside a for loop inside a while loop will be called?
I'm studying for my exams and a came through this exercise but I can't prove the result I found.
Given this piece of code:
...
0
votes
0
answers
53
views
What is bit (or binary digit)?
So, if I were to represent 23 in binary, what are bits here? Are 0 and 1 called bits? What they mean when they say I have five bits of information?
0
votes
0
answers
72
views
How to help compiler do pipelining?
I don't mean compiler flags for pipelining. I would like to program in a way that helps the compiler do optimizations using pipelining. I mean I want to order instructions in C in such a way that GCC (...
0
votes
0
answers
440
views
matrix product openMP code in C runs slower in parallel than series
If I start with 4 threads when I run my code and increase thread number each time I run it, my run time decreases as you would expect. However, my run time for 1 thread is significantly smaller than ...
0
votes
0
answers
87
views
How do I compare these ranges of numbers efficiently?
I'm looking for an efficient way of testing eights. What happens is I need to check if a value is eights and discard it.
The numbers I need to check for are:
...
0
votes
0
answers
29
views
Protecting a specific sized message with some limitations
So I make a research on my own. I have a device it allows a 64bit message. I wanted to secure it but I 64bits arent just enough to hash it and encrypt it. Is there really any good Hash function out ...
0
votes
0
answers
764
views
Find the index of minimum number that is greater than key given of a sorted array, does these two functions return same result?
Give an array of integer has been sorted (non-decreasing order), we need find the index of minimum number number that is greater than key given, I wrote two functions, they're identical except the ...
-1
votes
1
answer
534
views
Checksum Algorithm that produces correct 16-bit checksum value for any given input
I need a checksum algorithm that produces the correct 16-bit checksum value for a given input. It's a packet recording from serial communication that I would like to reverse engineer.
I have two data ...
-1
votes
1
answer
41
views
Find the most frequent alphabet appearing in the given string. In case letter with same frequency, choose the one which comes first alphabetically
This is the desired result which I want: