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

learn more… | top users | synonyms

-5
votes
0answers
51 views

OS Development in C [on hold]

I'm almost too new in C. I come from a python background. However, I'm studying operating systems and I found out that most operating systems are built in C due to speed and ease of processing. So I ...
-1
votes
0answers
18 views

Closing Nonduplex Unnamed Pipes in C [migrated]

I have 8 children, and am trying to use 8 pairs of nonduplex unnamed pipes to communicate with them. Thus, I have 2 pipes for each child and 16 pipes in total (one for childRead_ParentWrite and the ...
0
votes
0answers
47 views

Use of SAL annotations for C++ [on hold]

Code analysis tool for visual studio is able to detect some kinds of errors statically if you annotate functions with SAL We used it at first in windows driver when code was mostly C code, and where ...
-6
votes
1answer
56 views

in c programming i need custom atoi code [on hold]

i want to subtract two 64 bit hex numbers(in c programming), 0x0000888888888888 -1st hex value - 0x00000000839DDB7A -2nd hex value = 0x0000888804EAAD0E =(need the above result in hex) The 1st ...
-1
votes
0answers
16 views

How to pause for a second in a C program? [migrated]

I'm creating a simple C program which prints to the console and I want to have the program pause between printing, to create an aesthetic "..." slow printing effect, to make it appear as if it is ...
-5
votes
0answers
80 views

What are the basics of software engeneering [on hold]

I want to be a software engineer what is the process where to start I want everything to be online.
1
vote
3answers
206 views

Alternative to goto-statement in this case? [duplicate]

Currently I am using gotos for closing handles and general cleanup if an error occurs. Since I don't want to nest all the ifs and a function for cleanup would require a return besides the cleanup(); ...
-5
votes
0answers
35 views

Help in C! get userinput then display! [on hold]

You wanna get info from user function to collect one current, and number of resistors, and each resistance value function to display as below -resistance is not an integer, round up to 3 decimals ...
-6
votes
0answers
34 views

Spoj Trie Problem [on hold]

Recently I've tried to solve a problem of SPOj. After submitting the solution it is giving me WA. :( I've tried with some cases and every input is giving me correct answer. But as the online judge ...
0
votes
1answer
43 views

Printing an geomterical object/structure and determining the mid point of the two lines passing through it

I am very basic in C programming, may be printing a variable or so. Can any one of you can help me to give me a example code or guide me how to construct an object and determine its mid point? Or to ...
-1
votes
0answers
14 views

Difference between (int*) calloc and just calloc? [migrated]

What is the difference between: int *array; array = (int*) calloc(5, sizeof(int)); and int *array; array = calloc(5, sizeof(int)); I don't get it. Both samples work. At the university the ...
2
votes
2answers
79 views

Function naming design in a C Library

I'm writing a C (c99) library that operates on strings. I'm having a design problem writing functions that will perform in different modes. For example; the Find function can search for: the ...
-4
votes
0answers
38 views

How can I create a program which records how much internet data is used by each website visited? [closed]

I don't believe this is even possible but it's worth asking, I would like to create a batch file that when run, it will record all IP addresses or URL's visited during an internet session. It won't ...
0
votes
0answers
4 views

C error: parameter has incomplete type [migrated]

I am a relatively new C programmer, so please bear with my ignorance :-) I am trying to get a custom tool for valgrind to compile. The tool was originally written about 8 years ago, and was based on a ...
-3
votes
1answer
36 views

Passing Parameters to pthread_create [closed]

I have a structure named graph. graph *G; Now I create memory of size of structure using malloc and the start pointer is stored in pointer G. G = (graph*)malloc(sizeof(graph)); My question is ...
4
votes
1answer
193 views

Should I always return an error code from C functions?

I have the following code in many places in a large application: if (datastruct.data_ok && cur_time > datastruct.start_time && cur_time < datastruct.end_time) { ...
-2
votes
0answers
67 views

Trouble inserting a node before head in circular linked list [closed]

I've created a C program for Circular Linked List using structures. I've completed all the parts except for the Insert before head part. The code i used for it is as follows: void insertathead() ...
0
votes
0answers
52 views

Writing Z80 table based assembler/disassembler

I have a long-term project: DIY computer with various processors. One of my wishes not only make hardware, but software too. So I started from assembler/disassembler for Linux, though there is a lot ...
-1
votes
0answers
11 views

Printing calculator- stephen kochan programming in C question [migrated]

I'm a newbie at programming, just one month into C. Working with stephen kochan's programming in C. There is a question in chapter 6 to write a printing calculator where 's' tell the program to set ...
0
votes
1answer
126 views

Can i create a function with variable parameters in C?

I've always wondered where a single function such as printf(); can take in variable parameters and provide the right results. For example, printf("Number is %d",a); which has two parameters, and ...
16
votes
9answers
3k views

Can you “stop” a C program from being reverse engineered? [duplicate]

I'm sure that many of the middle to high level languages can be reverse engineered. But if a C program can be reverse-engineered, and turned back into editable source code, how do I discourage such a ...
1
vote
3answers
100 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
10 views

escaping a complete packet read in apache module [migrated]

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
130 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 ...
2
votes
2answers
89 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 ...
1
vote
0answers
70 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
54 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
615 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
81 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
125 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
145 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 ...
55
votes
5answers
11k views

Why are there so few C compilers?

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
513 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 ...
3
votes
2answers
660 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
76 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
1answer
100 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
105 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
189 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
46 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 ...
2
votes
1answer
177 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
111 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
179 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
118 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 ...
3
votes
1answer
113 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
129 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
73 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 ...