C is a general-purpose computer programming language used for operating systems, games and other high performance work.

learn more… | top users | synonyms

0
votes
2answers
650 views

Better design for a generic doubly linked list around which I plan to make different wrappers?

I am currently writing a C code for a doubly linked list(dll) around which I want to write wrapers for implementing stack, queues etc. instead of writing separate codes for all of them. I'll be ...
4
votes
3answers
601 views

Rationale behind C library functions never setting errno to zero

The C standard mandates that no C standard library functions shall set errno to zero. Why exactly is this? I could understand it being useful for calling several functions, and only checking errno ...
0
votes
1answer
754 views

Having trouble understanding recursion [duplicate]

I have just started learning about recursion but I'm having a hard time understanding it. Please would you recommend any links or books that explain recursion in detail.
0
votes
4answers
1k views

How should I go about developing some basic C/C++ knowledge so that I can grok the concepts written in some Classic software programming books? [closed]

I know Java and JavaScript pretty well. I have never really worked on C/C++. But at this stage of my career I feel that the fact that I do not have adequate knowledge on C/C++ syntax(especially ...
3
votes
1answer
439 views

Pure C Vector Implementation

I am implementing a vector in C. I am doing this for the fun of programming, for the fun of learning, and for the use of the data structure in later projects. This is not homework. My question is ...
6
votes
4answers
2k views

When is the register keyword actually useful in C?

I am confused about the use of register keyword in C. It is generally told that its use isn't needed like in this question on stackoverflow. Is this keyword totally redundant in C due to modern ...
17
votes
7answers
2k views

Does modular programming affect computation time?

Everyone says that I should make my code modular, but isn't it less efficient if I use more method calls rather than fewer, but larger, methods? What is the difference in Java, C, or C++ for that ...
15
votes
4answers
317 views

how to determine minimum requirements of a software [duplicate]

Some software (commonly the commercial ones) producers provide minimum requirements, some examples: Skype, Diablo III, Ubuntu-Server and OpenOffice. I wonder how those minimum requirements are ...
4
votes
2answers
532 views

Learning YACC nowadays, does it make sense? [closed]

I have a huge project that is using YACC and I would need to fix a bug in it. I might ask someone else who wrote that to fix it but I'm interested in how compilers work. Does it make sense to learn ...
16
votes
4answers
940 views

Is it necessary to follow the standard , take the C standard for that matter?

May be this question is a duplicate and I am a dumb to ask it here, but I searched a bit and none of the titles suggested to answer my question exactly . There are some very experienced folks on SO ...
1
vote
2answers
362 views

Multiple Data Types for Single Variable in C

I am trying to implement basic cons, car and cdr of SCHEME in C. I have made a simple program that allows me to cons two integers as shown in the main program. However, I want my program to be able to ...
12
votes
4answers
943 views

When and for what purposes should the const keyword be used in C for variables?

While getting my code reviewed here the issue of using the const keyword came up. I understand that it is used for implementing read-only behaviour on variables. I am confused about what are the ...
4
votes
1answer
4k views

How do I learn modern C? [closed]

I started programming about 20 years ago with the first edition of the book C for Dummies. It was a great introduction to code and I am now a professional software developer. However, these days I ...
6
votes
4answers
1k views

What are some standard design methods to add GUI to a command line app? [closed]

I have an embedded linux c application that runs with a simple CLI. I am now tasked with creating a GUI that accomplishes the same functionality as the command line program. I am not an accomplished ...
1
vote
1answer
514 views

register variable in C and C++

I know the concept of register variable and it's use cases but there are few questions in my mind based on what I have tried. I cannot access the address of a register variable in C though I can do ...
1
vote
4answers
2k views

Help with learning the C++ Qt Framework [closed]

I've been a longtime PHP web developer. But now I've reached the limits and web doesn't fascinate me anymore. I am interested in learning cross-platform development. I have learned Java for almost a ...
3
votes
3answers
369 views

Blank lines in C

I'm working through K&R and I notice that their code is extremely tightly spaced. I haven't developed C since at University, but professionally most source from other languages I've worked in has ...
5
votes
4answers
661 views

How to familiarize myself with Python

I'm a Python beginner. I started programming with Python 1.5 months back. I downloaded the Python docs and read some parts of the tutorial. I have been programming on codechef.com and solving ...
2
votes
1answer
376 views

Are C or C++ The Only Viable Languages for a GC

Background I have just finished writing a compiler for a functional language compiling to the JVM as a learning project. However, since I'm just doing this to learn, I thought it might be interesting ...
4
votes
1answer
351 views

s expression representation for c

Experimenting with various lisps lately (clojure especially) i have wondered if there are any s expression based representations of (subsets) of c, so you could use lisp/closure to write macros and ...
2
votes
2answers
582 views

Concept of bit fields

Whenever I read a code like this: struct node { int x : 2; int p : 4; }n; with bit fields involved, I get really confused, as to how they are represented in memory, what ...
5
votes
6answers
6k views

Naming conventions used for variables and functions in C

While coding a large project in C I came upon a problem. If I keep on writing more code then there will be a time when it will be difficult for me to organize the code. I mean that the naming for ...
12
votes
4answers
1k views

Is there industry demand for developers who have no GUI experience?

Is there still demand for developers who crate software without GUI's in the industry? Are jobs still in demand? I only ask because I write a lot of software for myself in C. I mainly use FreeBSD ...
0
votes
1answer
820 views

Why nginx's http parser doesnt use regular expressions?

I see the http parser written by Igor Sysoev for nginx does not use regular expressions https://github.com/joyent/http-parser What could be the main reason for such design decision? I guess I could ...
6
votes
3answers
549 views

C project avoiding naming conflicts

I'm struggling to find pragmatic real-world advice on function naming conventions for a medium sized C library project. My library project is separated into a few modules and submodules with their own ...
4
votes
3answers
395 views

What is “short-circuiting” in C?

I have heard of the term "short-circuiting" being used in C. What does this mean and in what scenario would it be used?
17
votes
3answers
3k views

How to solve the problem of nested comments

It appears in not just one language that comments can't be nested. Do you have a good solution for this problem? One workaround in C/C++ and Java is to only use the single-line comment but it becomes ...
2
votes
1answer
144 views

.c FIle Dedicated to Data

Is it completely unheard of to have a .c file dedicated to just data? In my case, I'd be using it for global variables that are shared across two other .c files. Here's specifically how I'm using it. ...
6
votes
4answers
1k views

I am incompetent; how can I fix it? [duplicate]

I program in C and I believe I know the language well. I understand all the concepts and my problems never come from misuse of the language. I have problems because I always forget or oversee things. ...
1
vote
1answer
178 views

Design for migrating to Multitenant architecture

We are in a process of redesigning our product code in such a way so as to support multitenancy. Currently the implementation is such that one product deployment caters to only one customer. Thus ...
4
votes
6answers
3k views

sizeof style: sizeof(type) or sizeof variable?

I've seen two styles of using sizeof for memory-related operations (such as in memset or malloc): sizeof(type), and sizeof variable or sizeof(variable) Which one would you prefer, or would you use ...
7
votes
5answers
667 views

I believe I have mixed C and C++ code when I shouldn't have; Is this a problem and how to rectify?

Background/Scenario I started writing a CLI application purely in C (my first proper C or C++ program that wasn't "Hello World" or a variation thereof). Around midway through I was working with ...
8
votes
3answers
838 views

Reason for placing function type and method name on different lines in C

I just started at a company and one of the style comments at my first code review was that the return type and method name should be on different lines. For example, this void foo() { } should be ...
0
votes
0answers
264 views

How does a dynamic library's references to a static variable get translated once in the running app?

If a dynamic library exports the address to a global variable defined within the library, how are accesses to that variable translated during dynamic linking so that a running application can interact ...
2
votes
1answer
135 views

Evaluation order of the expressions

The C Programming Language by K & R states that C, like most languages, does not specify the order in which operands of an operator are evaluated. (The exceptions are &&,||,?: and ','). ...
-1
votes
2answers
106 views

I'm trying to figure out which functions from one C library are being used by C project. Does anyone have a simple solution? [closed]

To be specific, I want to know which function/types in libpri and being used in the Asterisk project. I'm not traditionally a C programmer, but I know some basic stuff because I took a class in ...
0
votes
2answers
521 views

Giving a double type for sqrt library function in C

The C Programming Language by Ritchie says that: The library routine sqrt expects a double type and will produce nonsense if inadvertently handled something else. So if n is an integer, we can use ...
1
vote
1answer
125 views

Implementation defined behaviour changing const type in c

The C standard states that if an attempt is made to change a const type,the result is implementation defined.This gives error on my system,but what does it depend on(compiler,os)? What are the ...
1
vote
3answers
289 views

Violation of the C definition?

The C standard states that any character in the machine's standard printing set will never be negative.But the following code: char c=1234; printf("%d\t%c",c,c); gives a negative output and prints ...
2
votes
1answer
433 views

Source code of jar.exe - is it available

This may seem an odd question, but I want to create an executable which runs under Windows written in C++. The program needs to be able to update a jar file even if Java is not installed on the ...
2
votes
4answers
536 views

Is Objective C a reasonable way to learn C?

I want to learn C but I tend to learn best when I have a project to work on. I've never done iPhone development, so I'm hoping to kill two birds with one stone. Will learning objective c also teach me ...
6
votes
1answer
2k views

Is this a valid example of a dangling pointer?

The book "Data Structures in C" (Horowitz and Sahni) suggests that in the following code the pointer pf is behaving as a dangling reference: float f,*pf; pf=(float*) malloc(sizeof(float)); *pf=2.6; ...
1
vote
3answers
7k views

Char and unsigned char [closed]

Where is unsigned char used in C ( please tell about some real-world examples )? Why would we need both char and unsigned char? Char ranges from -127 to 128 ( 8-bit integer ) Unsigned Char ranges ...
1
vote
2answers
185 views

Where is interface between button click and event raising defined

When I click on button, might be in windows apps, web apps, etc it has some animation to actually see it clicked and event is raised in background. I've knowledge of events and its attaching to button ...
0
votes
2answers
1k views

Why is C++ preferred over C for commercial applications? [closed]

I program in C mostly. However, it is pretty obvious that many more commercial applications are done in C++. As far as I can tell, C++ is a very complex language, with seemingly convoluted syntax and ...
11
votes
4answers
2k views

Is it possible to use the Intel C/C++ compiler on Linux to create object files to be linked on Windows?

Why? Depending on your source the Intel compiler is likely or most definitely the compiler generating the fastest executables for the x86 architecture (5 to 100 % execution time improvement). Intel ...
6
votes
1answer
4k views

Storing the EOF (End of File) character in a char type

I read in the Dennis Ritchie's The C Programming Language book that int must be used for a variable to hold EOF – to make it sufficiently large so that it can hold EOF value – not char. ...
5
votes
2answers
678 views

Implementing non-fixed length array support in a compiler

I'm thinking of building a language for PIC microcontrollers. I want to be able to use non-fixed size arrays, like this: Declare the variable as int[] Wait for input from serial connection Make the ...
7
votes
2answers
2k views

Why the ugly keywords in C11?

I am currently reading a draft of the C11 specification. The new introduced keywords: _Bool, _Alignof, _Atomic all feel like custom extensions, instead of standard reserved keywords like struct, ...
9
votes
4answers
887 views

Why do some programmers categorize C, Python, C++ differently? - regarding level [duplicate]

I am taking an introductory course on python and the instructor says that python is a high level language and C and C++ are low level languages. It's just damn confusing. I thought that C, C++, ...