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.

Filter by
Sorted by
Tagged with
-1
votes
0answers
18 views

Why doesn't my code fill in the augmented matrix properly? [closed]

I'm trying to input data from a training file. It is skipping the first row entirely. ...
1
vote
1answer
79 views

How does dynamic memory-allocation exactly work?

I have wondered about ordinary code. Assume we are running this code on any modern System like Unix/Linux/Mac/Windows. This code is C, but it should work with every language which is close to the ...
1
vote
0answers
33 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
2answers
462 views

How does casting really work for primitive data types? [closed]

I have written the following C code which purpose it is to flip an unsigned number in binary representation and give back an unsigned number: ...
0
votes
1answer
82 views

radix-sort with different bases

So i understand how to use radix-sort in base 10 and utilize mod 10 to go through the numbers. But not sure about 2,8 or 16. Does it follow the same idea? and i read somewhere that i need to pass ...
1
vote
1answer
48 views

Sizeof function definition in a system

Why sizeof(int) and sizeof(int *) takes different value in a system? I mean generally size of integer is 4 B, but size of integer pointer is 8 B. But why they cannot take same value, although their ...
1
vote
1answer
53 views

Complete the following table by specifying the scope of each declaration

I'm having a hard time understanding this question. Can each declaration have more than one scope or can a declaration have more than one scope? If it's the later it would be: Declaration ...
-2
votes
1answer
37 views

Doubt in definition of Float

Can anyone tell the meaning of the bold portion? Float: It is used to store decimal numbers (numbers with floating point value) with single precision.
0
votes
0answers
81 views

Is C actually turing complete follow up [duplicate]

I am picking up from this thread for which I have no privileges to comment on: Is C actually Turing-complete? I was wondering if there's any progress on this and what the conclusion actually was. ...
0
votes
2answers
51 views

Where can I code in C? [closed]

I have an upcoming CS course in uni that uses C and I want to get ahead a little bit this Christmas break but I'm having a hard time figuring out where I can actually code using C. My school uses this ...
1
vote
1answer
63 views

In a kernel, what are “global constructors”?

I am a beginner developing kernels (though I have developed several Hello World programs in C and C++). I frequently see reference being made to global constructors (e.g., osdev https://wiki.osdev.org/...
1
vote
0answers
49 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 ...
0
votes
1answer
86 views

Convert for loop into math sigma notation

Have some code (written in C), need the equivalent notation for mathematics. Is it possible using if-statements and sigma notation for this, and if so, how? ...
1
vote
2answers
48 views

Are Kernel Codes (which are written in C) compiled during boot time?

I have a confusion regarding how the Kernel is loaded during the boot time. The intuition I have is like following: During installation of an OS, the compiled Code of the Kernel (depending on the ...
0
votes
3answers
383 views

What is standardization in computer science?

I was reading about the differences standards and specifications for C. I understood that programming languages are usually stadardized and I learnt that there are different approches to ...
0
votes
1answer
55 views

How should I “read” a dereference operator?

For example, when I look at some code like int x = 1; int * y = &x; I can read it like ...
1
vote
1answer
288 views

Doubt regarding address calculation in two-dimensional arrays

I am reading about the address calculation formulas for one and two-dimensional arrays. I have two related doubts concerning it. In one of the problems, we are asked to calculate the ...
0
votes
3answers
996 views

Traverse Matrix in Reverse Diagonal strips

I thought this problem had a trivial solution, couple of for loops and some fancy counters, but apparently it is rather more complicated. So my question is, how would you write (in C) a function ...
0
votes
0answers
721 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
2answers
821 views

Since physical memory is the RAM where is logical memory stored on the computer?

Since logical memory maps to the RAM (physical memory) it has be stored somewhere right and it will obviously take large bunch of memory of itself. Where is it stored?
3
votes
3answers
359 views

How to enhance my skills as a programmer [closed]

I want to learn Cryptography and so I am interested to master C-programming. I know the basic concepts of C-programming like how to use an array,pointers etc. I want to develop myself so that I can ...
4
votes
0answers
124 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 ...
4
votes
1answer
115 views

Sorting Algorithm with constraints

I am looking for a sorting algorithm to help me in my work. My objective is the following: after receiving an input of this kind: 5 4 1 2 2 3 3 4 4 5 The first ...
1
vote
1answer
87 views

Formal specification; Logical formula

* Initial Question * I'm trying to write a logical formula consists of three Boolean variable C1, C2, C3. My program takes graph as input and checks properties about them. C1 represents presence of ...
0
votes
1answer
435 views

Column Major Order

I have a doubt understanding How a 3-Dimensional array is stored in column Major Order. An array in Row Major order is stored like [plane][row][column] So, for finding address of any element we cross ...
27
votes
2answers
3k views

Why is C's void type not analogous to the empty/bottom type?

Wikipedia as well as other sources that I have found list C's void type as a unit type as opposed to an empty type. I find this confusing as it seems to me that <...
38
votes
9answers
9k views

Is C actually Turing-complete?

I was trying to explain to someone that C is Turing-complete, and realized that I don't actually know if it is, indeed, technically Turing-complete. (C as in the abstract semantics, not as in an ...
2
votes
1answer
560 views

Hash multiple integers directly using FNV-1a

An alternative version of FNV-1a hash spread on the internet, which operates directly on integers instead of bytes. The offset basis and prime are the same used in the original version, which operates ...
2
votes
1answer
84 views
-1
votes
1answer
612 views

What is the difference between the friend class and inheritance consept in C++? [closed]

In C++ ,friend class allows us to inherit the proprieties of one class to another class(es) which is also possible using inheritance. And also in inheritance we can set different levels of privileges ...
2
votes
1answer
124 views

What is this question asking for?-->Test this code, find an error in the program and “construct an instance to demonstrate the error” (in C) [closed]

I am learning the basics of the language C, and so far we have covered up to loops. This question is related to my assignment. The problem is I do not understand what the question is asking. I know ...
1
vote
2answers
99 views

use of C library in operating systems [closed]

I wonder, how is that operating systems make use of libraries as stdio.h if they themselves are the services? I am right? Is the operating system that interacts with the hardware to operations of I/O? ...
0
votes
0answers
582 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
vote
0answers
33 views

How is a complied program updatable? [closed]

We all know in the case of web sites, to make update just means opening the code, editing it and saving it. And to view the changes we just have to refresh the browser. But what about in the case of ...
-1
votes
1answer
43 views

Simple error in C [closed]

I cannot determine why the Celsius values in this code are producing rubbish values. (Look at second statement in the first for-loop). CODE: ...
7
votes
1answer
1k views

Is the Syntax of C Language completely defined by CFGs?

I think the Question is self sufficient. Is the syntax of C Language completely defined through Context Free Grammars or do we have Language Constructs which may require non-Context Free definitions ...
12
votes
6answers
15k views

Why do negative array indices make sense?

I have came across a weird experience in C programming. Consider this code: ...
2
votes
2answers
1k views

Handling untrusted string input in printf in C [closed]

I stumbled upon the MSDN Best Practices for Code Review. Under the section “Untrusted Inputs”, I found following which I didn't understand properly. Why is the following considered safe? ...