C is a general-purpose computer programming language used for operating systems, games and other high performance work.
17
votes
11answers
4k views
What is so difficult about pointers/recursion?
In the perils of java schools Joel discusses his experience at Penn and the difficulty of "segmentation faults". He says
[segfaults are difficult until you]
"take a deep breath and really try ...
-3
votes
0answers
61 views
Using old code on new version of Visual Studio [migrated]
I have a project which was started from 90s in C/C++. Therefore, it contains many old coding styles such as K&R-style function declaration, obsolete function, ...
The project works fine in Visual ...
-1
votes
1answer
121 views
Why is n given the initial value of 1 in this loop?
From Kochan's "Programming in C":
Input:
printf ("TABLE OF TRIANGULAR NUMBERS\n\n");
printf (" n Sum from 1 to n\n");
printf ("--- ---------------\n");
triangularNumber = 0;
for(n=1; n<=10; ...
1
vote
8answers
737 views
Why does the instruction “do” require a “while”?
Since this statement is so common:
while (true) (Java)
or
while (1) (C)
or sometimes
for (;;)
Why is there not a single instruction for this? I could think that an instruction that could do it ...
0
votes
1answer
92 views
The keyword const and the linker file
If I declare in a header file, for example, extern unsigned long * Ptr;
and the value of this pointer Ptr in the linker file.
Will this adrress be 'constant'? Can I change its value ?
-1
votes
0answers
108 views
Should I read Kochan's “Programming in C” (10 years old) [on hold]
I plan on learning Obj-C and so I decided to do it by the book and learn C first. The problem: S.G. Kochan's highly acclaimed book "Programming in C" (3rd edition) is almost ten years old now1.
I ...
0
votes
2answers
153 views
Writing generic code when your target is a C compiler
I need to write some algorithms for a PIC micro controller. AFAIK, the official tools support either assembler or a subset of C.
My goal is to write the algorithms in a generic and reusable way ...
0
votes
0answers
5 views
Parallelize code using CUDA [migrated]
If I have a code which takes struct variable as input and manipulate it's elements, how can I parallelize this using CUDA?
void BackpropagateLayer(NET* Net, LAYER* Upper, LAYER* Lower)
{
INT i,j;
...
-2
votes
0answers
49 views
Writing a basic C Shell - understanding argv[] [on hold]
I have an assignment for my class to write a basic C Shell. I have found many pages that explain parts of it and some fully implemented code. I'm not going to copy, i'm just using it right now as a ...
1
vote
1answer
70 views
structure problem in Relational DBMS creation
For learning and understanding purpose, I currently want to try to make a small relational DBMS with simple features like (for now) only sequential reading/writing and CREATE TABLE, INSERT, SELECT, ...
50
votes
15answers
10k 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 ...
2
votes
4answers
332 views
Why do we use to talk about addresses and memory of variable in C?
Why do we use to talk about addresses and memory of variable in C, where in other languages (like in Java, .Net etc) we do not talk about variable address and memory in a program, we will directly use ...
-2
votes
0answers
125 views
A friend told me Python is garbage, I'm taking web design classes in the Spring and I have a textbook on C++. What should I do? [closed]
I dont know if I should start digging into Python beforehand just to get acquanited with programming and "whet my appetite" or if I should work on the C++ book...
Python definitely has more resources ...
0
votes
0answers
169 views
What is the logic behind this C Program? [migrated]
Here is a small piece of program (14 lines of program) which counts the number of bits set in a number.
Input-Output --> 0-->0(0000000), 5-->2(0000101), 7-->3(0000111)
int CountBits (unsigned int x)
...
8
votes
7answers
4k views
C/C++ Best indentation length? [closed]
I was reading a Vim tutorial ( http://www.oualline.com/vim-cook.html#drawing ), and came across this:
This is very useful if you use a 4 space indentation for your C or C++
programs. (Studies at ...