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

learn more… | top users | synonyms

4
votes
5answers
329 views

Structuring Procedural vs OO code

I have spent the vast majority of my programming career using Java and very OO based C++. I am really interested in learning to think more procedurally, so I have been starting to do some practice ...
-2
votes
1answer
46 views

how integer type can handle text stream (getchar()) in C? [on hold]

While going through C programming by Ritchie and kernighan, I came across the following code. #include<stdio.h> int main() { int t; t = getchar(); while ((t=getchar()) != EOF) { ...
-1
votes
0answers
15 views

Retransmission logic [on hold]

I've implemented a buffer for TCP retransmission but I can't seem to get on a solid logic for monitoring the sequence number and acknowledgment of the sent packet. Can someone help me make an ...
1
vote
2answers
268 views

Function calls to calls in windows api

When programming in Windows, how does Windows communicate with the programs that run on it? When you incorporate a function call which is in another memory location on the disk or memory (not a ...
15
votes
3answers
2k views

What happened to Concurrent C?

I recently checked out a fantastic book from my college library. It is a bit old at 1989, but the language it describes sounds rather nice. And even while I may not be using it soon, I wanted to ...
9
votes
4answers
723 views

What features did c get from c++? [on hold]

What features were added to C that were originally in C++? When where they added and for what reason(what where the pro/con arguments)? How do they differ in C as compared to C++? Did the features ...
0
votes
1answer
50 views

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

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 ...
2
votes
2answers
198 views

How does printf write to stdout?

I've been looking for an answer to this for a couple days, and all of the results I've come up with are about how printf accepts an arbitrary number of arguments. How does printf write to stdout? ...
-4
votes
0answers
30 views

C tcp server; connected client data structure [closed]

So i was questionning myself on this: How does C server maintain a list of connected client IE: I am identified on the server via a handle : Client1, I would like to send a message to Client2 I ...
8
votes
5answers
1k views

When does it make sense to compile my own language to C code first?

When designing an own programming language, when does it make sense to write a converter that takes the source code and converts it to C or C++ code so that I can use an existing compiler like gcc to ...
-1
votes
1answer
105 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 ...
0
votes
3answers
227 views

Socket Connecting to Large number of IPs

I have a text file of ~600 CIDR notation IP blocks which, when expanded, amount to ~17.5M IP addresses. I need to socket connect to each one. If it connects, I add it to a "live" list, if it returns ...
-2
votes
1answer
27 views

TCP/IP Retransmission [closed]

I'm trying to code a linked-list data management system for tcp retransmission in c. I have the sending and receiving logic set solid. Any help in this regard will be much appreciated. Thank you
-1
votes
0answers
33 views

Virtual embedded system [closed]

I want to learn Linux Embedded System programming. But right now I can't afford buying embedded hardware like Raspberry pi. I just want to know is there any virtual embedded system that I can try for ...
-6
votes
0answers
50 views

C and Java Programmar [closed]

I am currently pursuing computer science in college. 1)I want to be a professional C and Java J2SE Developer...(not only a programmar)...so that I can develop system softwares,customize linux shell ...
-1
votes
2answers
88 views

In C is it possible to change http requests to https [closed]

Long story short I've got this package that currently has a security risk where credentials are sent over http and I need to convert them to https but I currently lack the knowledge to do so. Could ...
-3
votes
0answers
33 views

Text UI strategy game: Which Language/engines? [closed]

I'm thinking about building a simple 2d strategy game, the likeness of starcraft, except extremely simplified. The main thing I want to do is have a text UI, the kind of thing you see when you ...
-1
votes
0answers
32 views

int differers in level of indirection from char error [migrated]

The code is from Absolute beginner's guide to C, and I get this error ./BlackJack.c<41> : warning C4047: '==' : 'int' differes in levels of indirection from 'char [2]' when I try to compile it ...
16
votes
8answers
906 views

Is directly using Make considered obsolete?

So I have been coming across many comments/posts/etc regarding creating makefiles directly, and how it is a silly thing to do in 2015. I am aware of tools such as CMake, and I actually use CMake quite ...
1
vote
5answers
363 views

How to share memory between applications written in C/C++

I'm going through a program written in C/C++ for control in robotics. Basically, three different programs run at the same time, and they communicate via shared memory. Google-ling around I found ...
1
vote
2answers
493 views

Is there a better way to organize my module tests that avoids an explosion of new source files?

I've got a neat (so I thought) way of having each of my modules produce a unit-test executable if compiled with the -DTESTMODULE flag. This flag guards a main() function that can access all static ...
1
vote
3answers
5k views

Tips on Converting a C program to Pure Python [closed]

I'd like to convert an open source C application to pure python (not to Cython, IronPython etc). The documentation and presentations of the original creator of the C application has given me a good ...
0
votes
0answers
120 views

Why does this execute a jump instruction? [migrated]

I have just seen a very interesting C code in the boot loader of a small embedded product. The code consists of two parts: boot loader and the main code. The start of the main code address is stored ...
49
votes
13answers
3k views

Philosophy behind Undefined Behavior

C\C++ specifications leave out a large number of behaviors open for compilers to implement in their own way. There are a number of questions that always keep getting asked here about the same and we ...
11
votes
1answer
223 views

What are the absolute, minimal requirement for containing SE Asian charsets for an embedded system project?

I work for a company that has begun integrating embedded computer systems into our products that we manufacture. We have a pretty wide range of products and they are distributed across the globe. ...
0
votes
0answers
50 views

Abstract Web API from validation and configuration management in embedded system

Im working with embedded Linux for a router. There is a web GUI for the user to configure router options. When user fill a web form this is submitted to a web server function that is responsible of ...
2
votes
1answer
207 views

How can C++ make it possible to use dynamic container classes even in embedded systems?

How can C++ make it possible to use dynamic container classes even in embedded systems? Background info: I've been working with PIC (C) and AVR (C++) processors and at the moment (PIC C) I'm ...
0
votes
1answer
127 views

Has pre-increment operators become that common? [closed]

Bit of background to explain the reasoning: I've been programming for a good while, but took a break between 2012 and 2014 for other stuff. Before that break, I would hardly ever hear about "++i", let ...
0
votes
2answers
85 views

Idiomatic C API with regards to pointers

I am trying to get a better understanding of how one would structure an API in C. I create a struct Person I have a init function that sets data on that struct I have multiple "helper" functions ...
0
votes
0answers
14 views

Threads to print numbers sequencially : with even and odd threads running parallely [migrated]

I am new to multithread programming. I tried to print numbers sequentially using even and odd number printing threads, running in parallel. When executed, the code enters a deadlock. Can anyone help ...
1
vote
0answers
72 views

GNU Simulated Annealing [migrated]

I'm working from the template program given here: https://www.gnu.org/software/gsl/manual/html_node/Trivial-example.html The program as they give it compiles and runs perfectly, which is nice. What ...
0
votes
0answers
3 views

protobuf-c message over poll() read [migrated]

protobuf-C packs uint8_t chars and I am trying to unpack them from a poll recv() command. Is this a compatible format recv(int sockfd, void *buf, size_t len, int flags) call?
0
votes
2answers
83 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 ...
-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 ...
1
vote
3answers
219 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(); ...
6
votes
2answers
1k 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 ...
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 ...
2
votes
2answers
89 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 ...
5
votes
5answers
3k views

Is it better to use preprocessor directive or if(constant) statement?

Let's say we have a codebase that is used for many different costumers, and we have some code in it that is relevant only for costumers of type X. Is it better to use preprocessor directives to ...
-3
votes
1answer
41 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
207 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) { ...
12
votes
5answers
2k views

Advice for an ambitious student on building your own kernel [closed]

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 ...
0
votes
0answers
62 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 ...
0
votes
1answer
133 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 ...
0
votes
2answers
1k views

Assigning strings to pointer in C Language

I am a new learner of C language, my question is about pointers. As far i learned and searched pointers can only store addresses of other variables, but cannot store the actual values(like integers or ...
1
vote
3answers
107 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
vote
2answers
132 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
112 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 ...
137
votes
6answers
24k views

Is every language written in C?

Sometimes while programming in different languages (C/C++, C#), this thought comes to my mind: Is each and every language written in the C programming language? Is the C language the mother/father ...