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

learn more… | top users | synonyms

-3
votes
0answers
16 views

a free light and fast DICOM C/C++ tool [on hold]

I am looking for a free (free for be integrated in commercial product) licensed, light weight and fast DICOM tool, so that I can read the information (pixel intensity, header....) from DICOM file. ...
1
vote
3answers
67 views

Will C compiler attach the whole object code of the header file?

When you compile a C source code does the compiler convert the whole header file to object code or just the functions of the header file you use? Like for example, in the header file #include ...
-1
votes
0answers
7 views

escaping a complete packet read in apache module

According to this site: http://pedrowa.weba.sk/docs/ApiDoc/apidoc_ap_get_client_block.html This function: ap_get_client_block(request_rec *r, char *buffer, int bufsiz); Reads a chunk of POST ...
1
vote
2answers
111 views

In C, what is an unconditional jump?

I have to fill out some documentation regarding a C project i worked on. One topic is whether I used "unconditional jumps". As far as I know, a "break" statement counts as a jump. And I have a few of ...
-1
votes
0answers
41 views

Handling race conditions in C using the most efficient method

I created my own linux apache module in C but after installing it on the server, I found out that in a day, the server receives at least 1,000 requests of which 4 return a segmentation fault message ...
2
votes
2answers
72 views

Returning multiple values from a c function using pointers; style of parameter list

What is good programming style for writing C-language functions and function calls to functions which return pointers? For example, if I have a function my_function which return two integers through ...
0
votes
0answers
4 views

Help with enum in C [migrated]

I am trying to understand some C code in a legacy database. There are constructions there of the form: enum {a=0,b,c,d}; What does this achieve ? In the manuals, I only see constructions of the ...
0
votes
0answers
37 views

web requesting - time competition - javascript? [on hold]

first of all, I would like you to excuse my english and description of the problem. I am not english native speaking, so I am trying my best.... Before you say, that is am abusing some server- I need ...
-2
votes
1answer
31 views

Service that compile & test your C code on different platforms [on hold]

I was wondering if there was some service that would compile & run automated tests on different platforms like multiple versions of Windows, Linux, Mac etc. and give you a report about any ...
1
vote
0answers
66 views

How to use an enumeration type, when the values are not known at first?

We have a project, that consists of a cluster of C source code, a C library and a C++ library. The C++ library is dependent only upon the C library, or at least that is what I am trying to achieve. ...
-2
votes
0answers
20 views

Strange behaviour of visual studio 2008 with escape sequence [migrated]

Regarding C programming language, the descriptions of escape sequence does not resolve the output of following line in visual studio 2008. char * str = "??/abc"; printf( "%s", str ); it prints only ...
0
votes
1answer
52 views

forking but not exiting

It is normal for the child in a fork() to call exec() or _exit(). Are there any realistic scenarios where the child might return from the function that called fork() instead? void foo() { pid_t ...
11
votes
2answers
557 views

Java has the JVM, what does C have?

I know that C has a compiler but what determines execution performance? For example in an if else block, what if the code just had all ifs instead of if elses, what determines that all the ifs will ...
2
votes
2answers
63 views

Should I use multiple state machines for a layered protocol?

When implementing a layered communications protocol are layers commonly implemented as state machines? I have an implementation of PMBus I am currently working on for an embedded device. I have a ...
-1
votes
3answers
110 views

is it possible to make a gui in c without an external library [closed]

I was wondering if it is possible to make a gui application in c without the use of an external library (like gtk+ or wxWidgets). And if it not possible without the use of an external library, how ...
-1
votes
0answers
95 views

Convert an 8 bit data to 3 bit data [migrated]

PROGRAMMING LANGUAGE: C I've a 8 bit data with only 3 bit used, for example: 0110 0001 Where 0 indicate unused bit that are always set to 0 and 1 indicate bits that change. I want to convert this ...
0
votes
2answers
102 views

Trouble understanding simple recursion in c [duplicate]

My function: int num(int x) { if(x>0) num(x-1); else return 0; printf("%d",x); } This function takes a input x and prints the numbers from 1 upto x.I can't seem to ...
-3
votes
2answers
133 views

Can a high level language be faster than native C? [closed]

Hand-crafted C is almost unbeatable. If an experienced C developer knows what he is doing, he will be able to write C code much faster than higher level code. But can a medium/big programme written in ...
53
votes
6answers
10k views

Why are there so few C compilers? [closed]

C is one of the most widely-used languages in the world. It accounts for a huge proportion of existing code and continues to be used for a vast amount of new code. It's beloved by its users, it's so ...
0
votes
5answers
488 views

Is a makefile really needed

I have been programming in c/c++ for a while now, and I have never once used a makefile. I know that it is supposed to be useful when you are dealing with a large project, but I have always been able ...
1
vote
0answers
14 views

How to use mcheck? [migrated]

I am trying to understand how heap consistency checking works in GNU C Library. I Refered http://www.gnu.org/software/libc/manual/html_node/Heap-Consistency-Checking.html#Heap-Consistency-Checking ...
3
votes
2answers
623 views

How do you usually compile C/C++ source code ? (Large code bases) [closed]

It's been quite some times since I began learning C and C++ but I've been very limited only to the Windows platform and the Visual Studio environment. Recently, I wanted to look into some open source ...
-1
votes
1answer
71 views

Understanding the solution of exercise 1.16 of K&R as given in the “The C Answer book”

The exercise 1.16 in K&R's book asks, Revise the main routine of the longest-line program so it will correctly print the length of arbitrary long input lines, and as much as possible of ...
-1
votes
0answers
51 views

Understanding the program that reads a set of text lines and prints the longest in K&R's book [migrated]

I'm reading K&R's book, section 1.9. The program for printing the longest line, from a given set of lines, is given as #include <stdio.h> #define MAXLINE 1000 /* maximum ...
-1
votes
1answer
72 views

How static functions are better than Class Methods in Objective-C [closed]

I was going to through this post by Mattt Thompson in which he mentions that Static functions are nicer than shoe-horned class methods I just don't see any flaw with Class methods in ...
0
votes
2answers
102 views

Organizing C++ Components [closed]

In my current company we've brought the discussion about how to organize most of our different C++ components considering the following requirements: There might be interdependencies between ...
0
votes
1answer
170 views

Understanding the solution of Exercise 1.12 of K&R's book as given in the book “The C Answer Book”

I am reading the solution of "The C Answer Book". I think that the solution of Ex. 1.12 can be shortened. The Exercise is as, Write a program that prints its input one word per line. The ...
0
votes
3answers
45 views

Data inter-exchange with C

I'm developing a system in which a C coded TCP server is listening for new connections from clients, on connection parse the data & store into database. I'm familiar with JSON, and would like to ...
-3
votes
0answers
38 views

Proper Decimal Problem? [migrated]

#include <stdio.h> int main (){ float M=2E30, G=6.67E-11, m=6E24, r=1.5E11; float F= (G*M*m)/(r*r); printf("F is %f",F); return 0; } I am trying to print the value of F with ...
2
votes
1answer
166 views

An embedded C developer wishing to interface some code with a web page

Okay, so as the title says, I'm an embedded C/C++ developer. Right now, I'm working on a project that involves a client/server C application. The server side of the application is running on ...
2
votes
1answer
104 views

Functions returning strings, good style?

In my C programs I often need a way to make a string representation of my ADTs. Even if I don't need to print the string to screen in any way, it is neat to have such method for debugging. So this ...
2
votes
2answers
175 views

Place variables frequently used by the same function on the heap?

Say that I have the following situation: void myFunc() { int x; //Do something with x } "x" is placed on the stack which is no doubt fast. Now, "myFunc" is called very frequently, lets say ...
0
votes
1answer
114 views

C-library - newbie guide

I have been asked to provide a C-library of my code (which I have written in a high-level language). I will hire a programmer to implement my code in C. I would like a short introduction to what a ...
0
votes
0answers
7 views

Initializing complex structure, GCC warns: initialized field with side-effects overwritten [migrated]

I'm coding a backgammon position evaluation system and I'm trying to use designated initalizers, compound literals and a variadic macro to create a keyword argument function like described here , and ...
3
votes
1answer
106 views

Transpose a matrix without a buffering one

How is it possible to transpose a MxN matrix without using a "buffering" matrix? In the latter case it's easy and quite the "classic" approach... Given a matrix[M][N], I would like to put it into a ...
3
votes
1answer
116 views

Structure of stack of a function call

I've been reading Aleph One's paper on Smashing the Stack for Fun and Profit. I wrote down example1.c from his paper, modified it a bit to see what the stack looks like on my system. I'm running ...
-1
votes
1answer
70 views

How to create user defined conditional statements in c? [closed]

I have two stacks s1 and s2 with numbers stored in them. I have a function(say comp) which compares the numerical values of s1 and s2. I want to know if it is possible to modify the function so that ...
0
votes
3answers
139 views

Understanding the concept of “arguments” and “parameters” in C language as explained in K&R The C Programming Language

In the third last paragraph at page number 26 of the ebook "The C Programming Language" the author(s) say, "We will generally use parameter for a variable named in the parenthesized list in a ...
3
votes
3answers
98 views

sorting / merging hashtable

For my project I have a hashtable with 1M buckets (sometimes more). Each bucket contains lots of values and they are stored sorted in a dynamic array. I am looking for easy enough way to store all ...
0
votes
1answer
175 views

Exercise in 1.6 C by Kernighan and Ritchie

I'm using this book by Kernighan and Ritchie, on the chapter about character input and output and file copying, I'm totally lost as to what this chapter is talking about. This question may seem too ...
0
votes
2answers
215 views

What kind of applications are built using C [closed]

I studied C programming about ten years ago, whiles in Uni,however I would like to pick it up again. I'm looking at developing secure applications that utilize cryptography. Would C be the right ...
3
votes
4answers
293 views

int * vs int [N] vs int (*)[N] in functions parameters. Which one do you think is better?

When programming in C (or C++) there are three different ways to specify the parameter in a function that takes an array. Here is an example (implementing std::accumulate from C++ in C) that shows ...
0
votes
2answers
123 views

How much does C help you in other languages? [duplicate]

How much does learning C to moderate level help you as a programmer. For example, does being competent in C make it easier to pick up languages as time goes on and get a better understanding of them?
1
vote
1answer
139 views

How to represent “class” data type in C or any low level language? [closed]

I'm writing a simple language compiler,currently it's support functional programming only. I want to support OOP concept, but I don't know how exactly I can represent an object ? just where to start ...
3
votes
2answers
200 views

Is it always safe to shift bool values?

I stumbled about a Cppcheck warning (an inconclusive one), that I mistakenly used & instead of &&: /// @param code identifies the command. Only the lower 16 bits of are being processed ...
4
votes
1answer
152 views

Using macros to protect assignment to global variables

Because there is no language feature in C to protect assignment to global variables would you recommend doing something like this? Take this example: We have a module with the header file called ...
0
votes
1answer
136 views

(almost) Pure C instead of C preprocessor [closed]

Why isn't (almost) pure C used instead of the C preprocessor? Sure I understand it would be a little more verbose. For example: #define PI 3.14159 If we had regular C as preprocessor language, the ...
3
votes
1answer
93 views

Proper way of handling EINTR in libraries

What is the recommended etiquette when it comes to EINTR in libraries? I'm currently writing a function that does some file system tasks with the POSIX API, but a lot of the calls I use can ...
4
votes
1answer
196 views

Using macros to implement a generic vector (dynamic array) in C. Is this a good idea?

So far I have only done personal projects at home. I hope to get involved in some open source project some time next year. The languages I that have been using the most are C and C++. I have used both ...
6
votes
2answers
985 views

Why is C still in the category of High Level Language? [closed]

Many of the textbooks on the C programming language tell that C is a high-level programming language, but many of the tutors online say that C is also a middle-level programming language. Why is it ...