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

learn more… | top users | synonyms

140
votes
15answers
64k views

When to use C over C++, and C++ over C?

I've been introduced to Computer Science for a little over a year now, and from my experience it seems that C and C++ are both considered to be "ultrafast" languages, whereas others such as Python and ...
53
votes
16answers
9k views

I don't know C. And why should I learn it?

My first programming language was PHP (gasp). After that I started working with JavaScript. I've recently done work in C#. I've never once looked at low or mid level languages like C. The general ...
106
votes
19answers
65k views

Is there any reason to use C++ instead of C, Perl, Python, etc.? [closed]

As a Linux (server side) developer, I don't know where and why should I use C++. When I'm going to performance, the first and last choice is C. When "performance" isn't the main issue, programming ...
39
votes
12answers
12k views

What's the benefit of object-oriented programming over procedural programming?

I'm trying to understand the difference between procedural languages like C and object-oriented languages like C++. I've never used C++, but I've been discussing with my friends on how to ...
20
votes
22answers
5k views

Is learning how to use C (or C++) a requirement in order to be a good (excellent) programmer?

When I first started to learn how to program, real programmers could write assembly in their sleep. Any serious schooling in computer science would include a hefty bit of training and practice in ...
51
votes
15answers
13k views

What makes C so popular in the age of OOP?

I code a lot in both C and C++, but did not expect C to be the second most popular language, slightly behind Java. TIOBE Programming Community Index I'm curious as to why, in this age of OOP, C is ...
51
votes
3answers
17k views

How is a Java reference different from a C pointer?

C has pointers and Java has what is called references. They have some things in common in the sense that they all point to something. I know that pointers in C store the addresses they point to. Do ...
22
votes
3answers
7k views

How could the first C++ compiler be written in C++?

Stroustrup claims that Cfront, the first C++ compiler, was written in C++ (Stroustrup FAQ). However, how is it even possible that the first C++ compiler be written in C++? The code that makes up the ...
16
votes
12answers
4k views

int* i; or int *i; or int * i; [closed]

What is your favorite method to declare a pointer? int* i; or int *i; or int * i; or int*i; Please explain why. see also: http://www.stroustrup.com/bs_faq2.html#whitespace
13
votes
5answers
18k views

How to write a very basic compiler

Advanced compilers like gcc compile codes into machine readable files according to the language in which the code has been written (e.g. C, C++, etc). In fact, they interpret the meaning of each codes ...
44
votes
16answers
5k views

Languages on a resume: Is it better to put “C/C++” or “C, C++”?

I'm graduating in a couple of weeks, and my resume (as expected) lists the languages that I've had experience with. Previously I've put "C/C++", however back then I didn't have that much experience ...
3
votes
5answers
1k views

What is the best method to start understanding BIG project source code? [duplicate]

Possible Duplicate: How do you dive into large code bases? Sometimes before developing new products we need to understand some existing products or existing source code. Sometimes to ...
52
votes
17answers
41k views

Is the C programming language still used?

I am a C# programmer, and most of my development is for websites along with a few Windows application. As far as C goes, I haven't used it in a long time, as there was no need to. It came to me as a ...
25
votes
8answers
10k views

Are C and/or C++ viable/practical options for web development? [duplicate]

I am proficient in C, and I am learning C++ right now. I always played with websites (HTML/CSS), and I was wondering if it would be viable/practical to create some simple web apps using C and/or C++. ...
10
votes
7answers
3k views

OO best practices for C programs

"If you really want OO sugar - go use C++" -- was the immediate response I got from one of my friends when I asked this. I know two things are dead wrong here. First OO is NOT 'sugar', and second, C++ ...
22
votes
13answers
3k views

Low level programming - what's in it for me?

For years I have considered digging into what I consider "low level" languages. For me this means C and assembly. However I had no time for this yet, nor has it EVER been neccessary. Now because I ...
16
votes
5answers
5k views

What is the history of the C compiler?

When we say that "Dennis Ritchie developed C language", do we mean that he has created a compiler (using an 'already' developed other language) which can compile the source code written in C language? ...
4
votes
6answers
2k views

Is there a language that transcompiles to C with a better syntax? [closed]

CoffeeScript is a language with a very clean Ruby-like syntax that transcompiles to JavaScript. Does the same thing exists with C? Then writing more readable and as fast as original C programs would ...
69
votes
16answers
9k views

Do the young minds need to learn the pointer concepts?

Why did the C master Dennis Ritchie introduce pointers in C? And why did the other programming languages like VB.NET or Java or C# eliminate them? I have found some points in Google, and I want to ...
12
votes
7answers
6k views

What are some good open source c++ packages to study in order to learn advanced software construction? [closed]

I've heard that you should read 10 times more than you should write. This applies to both literature and source code. Therefore, I'd like to study the best c++ packages we've developed. I'm ...
15
votes
7answers
4k views

Learning to program in C (coming from Python) [closed]

If this is the wrong place to ask this question, please let me know. I'm a Python programmer by occupation. I would love to learn C. Indeed, I have tried many times, but I always get discouraged. In ...
104
votes
6answers
6k views

Why hasn't a faster, “better” language than C come out? [closed]

With all the new "modern" languages out today, how is it that C is still heralded as the fastest and "closest to the machine"? I don't really believe in there ever being only one correct way to do ...
30
votes
17answers
6k views

How can I feel more confident about my programming skills? [closed]

Programming isn't alien to me. I first starting doing markup (HTML, now please don't laugh at me) when I was 12 and a little bit of BASIC when I was 13 (I knew much about Flowcharts, Pseudocodes at ...
11
votes
2answers
697 views

Adding unit tests to a legacy, plain C project

The title says it all. My company is reusing a legacy firmware project for a microcontroller device, written completely in plain C. There are parts which are obviously wrong and need changing, and ...
14
votes
4answers
1k views

Enhancing the level of my C/C++ code

I have been programming for 3-4 years now and feel I can no longer be called a beginner, but I read some questions on this site and think WTF are they talking about? I feel the same way when I pick up ...
6
votes
4answers
2k views

GO instead of C/C++ with cgo

Is it possible to replace C and C++ with Go + cgo and interface frameworks such as Qt or DirectX with Go? Any potential pitfalls I should be aware of? UPDATE: I see that my question was not precise ...
4
votes
10answers
1k views

I'm 15 years old. What would you recommend for resources? [closed]

I'm a 15 year old kid who seems to excel in all of his classes, likes talking in 3rd person, and wants to learn more about programming and a little about html/php stuff. I already know a little ...
3
votes
7answers
4k views

What is C used for? [closed]

I learned C and want to try to use C as my primary development language. However, most jobs I see are for C++. So I want to know what I can do with C. What positions are usually open for a C ...
20
votes
9answers
2k views

Why is it so difficult to make C less prone to buffer overflows?

I'm doing a course in college, where one of the labs is to perform buffer overflow exploits on code they give us. This ranges from simple exploits like changing the return address for a function on a ...
6
votes
11answers
3k views

Learning C, C++ and C# [duplicate]

I'm sure you guys are tired of this question but after wading through hours of similar posts and questions I've really not made any progress to my specific concerns. I was hoping you guys could shed ...
5
votes
7answers
5k views

When is C a better choice than C++? [closed]

I can't imagine that there's any reason not to use the OOP features of C++. It's is just as fast as C, and - what's more important to me - it's transparent, just as C. (I mean "transparent" that I ...
2
votes
1answer
192 views

How to run thread if multiple data is insert in the multiple table

I'm facing problem in gsoap , if two user go to register at a same time then database is locked, i think its threading problem , how to handle it, please insist me. I am running multiple ...
5
votes
2answers
309 views

Writing functional tests for a legacy project

I am trying to add a couple of tests to a legacy C project. The project basically consists of a command line tool that prints something to stdout every time an event happens. Now, since writing unit ...
5
votes
8answers
1k views

Why has the rate of programming language popularization slowed down in recent decades? [closed]

If I understand correctly, there was a huge birth of programming languages during the early decades of computing, but then things have stabilized. Basically, why are many universities and industries ...
3
votes
9answers
1k views

Confusion of scope of a variable: Is Global Variable a solution?

I am newly learning C Programming. When we have a C Program with lot of functions, parameter passing, calling and all - It becomes a great problem as to which variable must be declared where. My ...
86
votes
19answers
15k views

Why isn't OCaml more popular?

I've always heard that C is the language of choice to use for embedded systems, or anything that needs to run at maximum speed. I never developed a fondness for C, mostly because I don't like pointer ...
62
votes
12answers
16k views

How can I convince my boss that ANSI C is inadequate for our new project? [closed]

A few months ago, we started developing an app to control an in-house developed test equipment and record a set of measurements. It should have a simple UI, and would likely require threads due to the ...
64
votes
3answers
21k views

Why do programming languages, especially C, use curly braces and not square ones?

The definition of "C-Style language" can practically be simplified down to "uses curly braces ({})." Why do we use that particular character (and why not something more reasonable, like [], which ...
18
votes
10answers
5k views

Why are pointers not recommended when coding with C++

I read from somewhere that when using C++ it is recommended not to use pointers. Why is pointers such a bad idea when you are using C++. For C programmers that are used to using pointers, what is the ...
46
votes
11answers
12k views

Why has C prevailed over Pascal?

My understanding is that in the 1980s, and perhaps in the 1990s too, Pascal and C were pretty much head-to-head as production languages. Is the ultimate demise of Pascal only due to Borland's neglect ...
13
votes
5answers
1k views

Advice for an ambitious student on building your own kernel

I'm a very ambitious university student who wishes to learn pretty much everything there is to know about computers (bash me if you want, I love learning). Recently I thought it would be a fun project ...
12
votes
6answers
6k views

What are the fundamental differences between C and C++? [closed]

Many tend to write "C/C++", as if they were the same thing. Although they share many similarities, they are clearly not the same. But what are really the fundamental differences between C and C++? Is ...
35
votes
15answers
10k views

If you need more than 3 levels of indentation, you're screwed?

Per the Linux kernel coding style document: The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program. What can I deduce ...
34
votes
2answers
6k views

What is the purpose of NaN boxing?

Reading 21st Century C I arrived at chapter 6 at the section "Marking Exceptional Numeric Values with NaNs", where it explains the use of the bits in the mantissa to store some arbitrary bit patterns, ...
18
votes
3answers
3k views

Is there any Boost equivalent library for C?

Is there any Boost equivalent library for C?
14
votes
17answers
8k views

Is it still relevant to learn C these days? [closed]

Back in the uni days, I had the opportunity to study C for one semester but I didn't take it any further because I can not see many job opportunities for C hence I learnt Java. These days I see more ...
54
votes
16answers
2k views

Why should I care about micro performance and efficency?

Many questions and answers on the C/C++ pages, specifically or indirectly discuss micro performance issues (such is the overhead of an indirect vs direct vs inline function), or using an O(N2) vs ...
6
votes
6answers
3k views

Why should we use low level languages if a high level one like python can do almost everything? [closed]

I know python is not suitable for things like microcontrolers, make drivers etc, but besides that, you can do everything using python, companys get stuck with speed optimizations for real hard time ...
20
votes
11answers
4k views

typedefs and #defines

We all have definitely used typedefs and #defines one time or the other. Today while working with them, I started pondering on a thing. Consider the below 2 situations to use int data type with ...
14
votes
8answers
3k views

Why is x=x++ undefined?

It's undefined because the it modifies x twice between sequence points. The standard says it's undefined, therefore it's undefined. That much I know. But why? My understanding is that forbidding ...