C is a general-purpose computer programming language used for operating systems, games and other high performance work and is clearly distinct from C++. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.

learn more… | top users | synonyms

1
vote
0answers
10 views

Calculate median and quartile in C without sorting the array

Here's a piece of working code wrote in C to calculate the median without putting all values in an array and sorting them. It reads values from a file. ...
4
votes
1answer
30 views

Convert a 24bit bitmap to grayscale

I wrote this so I can learn CUDA. This is coded to work on my laptop's Nvidia GeForce GT 540M. Main points I need reviewed: CUDA programming conventions Performance, especially kernel speed C ...
1
vote
0answers
20 views

Reading diagram code for an unpacking state machine [on hold]

I would like to ask if I have done my code right from diagram: ...
4
votes
3answers
178 views

Triangle categorizer — completely refactored and re-written

While reviewing a C question I started writing my own implementation and in no time I had a completely refactored completely different implementation. As the asker is learning I did not want to post ...
2
votes
1answer
52 views

Generating a triangle from integers

I've put together an algorithm for an assignment. I've done my best to try and keep it to a professional and readable standard. I'm posting it here so that I can get some feedback and suggestions on ...
2
votes
5answers
116 views

Writing the function strend()

Due to being unable to ask a C programming language expert or advanced user in person, I'm posting this simple question about my C code. Today I was refreshing my C with exercise 5.4 of the C ...
4
votes
2answers
59 views

K&R C section 1-20 - removing tabs

1-20 of K&R Exercise 1-20 Write a program detab that replaces tabs in the input with the proper number of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every ...
2
votes
1answer
34 views

Singly-Linked List In-Place Reversal

I've created a function in C to reverse a singly-linked list in place: ...
1
vote
1answer
23 views

Reading from file and storing as Linked List

This is the code I have: ...
-1
votes
0answers
18 views

Implementing AVL Tree in C [closed]

I'm learning about AVL Trees and I was going to attempt to implement it in C. But the code below is behaving differently than I expected. Basically, are there any errors in this code for an AVL Tree? ...
1
vote
2answers
31 views

Univariate polynomial multiplication using Doubly Linked List

A univariate polynomial is a polynomial over a single variable, and in the following discussion when we say polynomial, we mean a polynomial in a single variable. You are given two polynomials ...
1
vote
1answer
47 views

String reverse function

Are there more optimization possible in this code to achieve better performance and minimal memory usage? ...
5
votes
3answers
157 views

atoi implementation in C

I'm looking for feedback on my atoi implementation here in C. Any feedback would great. I made my own atoi for fun and to learn ...
-2
votes
0answers
9 views

How to make this program able to send any request created by the client program? [closed]

Have this program I need to make able to send any request created by the client. I'm not a pro at C programmering so please don't expect too much :) Here is the program: ...
6
votes
2answers
171 views

K&R exercise 1-19: reversing each line of input

This is my solution for exercise 1-19 of K&R: Write a function reverse(s) that reverses the character string s. Use it to write a program that reverses its input a line at a time. It works, ...
19
votes
5answers
2k views
+50

Recording Audio Continuously in C

As an ongoing little side project of mine, I've been working on recording audio with the C language. You can see a progression of my code by looking at my past two versions (V1.0, V2.0). I've ...
4
votes
2answers
172 views

Hex Editor in C

I had a homework assignment to create a simple hex editor that reads binary files as well as write integers to it. However I enhanced it a bit. Homework is already submitted, but that doesn't mean ...
4
votes
4answers
40 views

Math expression on-the-fly interpreter

In the last few day, I wanted to sharpen my C skills a bit, so I wrote a math expression interpreter that can handle + - * / ( ) and only integers. I just want to know how good this code is, if ...
14
votes
2answers
497 views

Python-like C string library

Most of the C code I have written has never been seen by anybody else, and I wonder if my code follows normal practices, especially how my code performs security-wise. The code is for a library that I ...
-1
votes
2answers
39 views

Reading large text file from network (SMB)

I am facing performance issues while reading a large text file from the network. The same file is read locally without any performance problems: ...
4
votes
1answer
76 views

Large Matrix Square Difference Means

I try to transfere Matlab calculation to C and call it using .mex for speed gains. My goal is to perform for a matrix \$ B\$ which has roughly the dimension 10000x1000 \$ ...
3
votes
0answers
24 views

Bilinear interpolation using Neon intrinsics

I'm trying to do a Bilinear interpolation on the ARM Neon. However, I find that my vectorized code is slower than the regular one, on a BeagleBone Black. Any idea why this could happen? I'm using ...
4
votes
3answers
294 views

ATM program in C

Had to create this for my class, figured I'd get some advice/insight on how I can advance my program while making it more efficient. Also want to help anyone who may come across the same assignment ...
5
votes
5answers
742 views

Implementing Caesar Cipher in C

I am trying to implement a "Caeser cipher" to every lower case character in a string, by using a number to control the amount of character rotation. Here is an algorithm that I came up with, can you ...
1
vote
0answers
17 views

Windows AppLocker extension - Owner rule

I am trying to extend Windows AppLocker behavior to add custom rule which checks owner of executables in Program Files and Windows folders. This would help us patch folders that are writable by ...
4
votes
3answers
53 views

Reserving seats in a movie theater

I'm writing a C program to reserve seats in a movie theater. I am validating the selection of seats: ...
2
votes
1answer
42 views

Kernel development

I'm trying to learn more about kernels, so naturally I started to program one. I'm using tutorials from here. Right now I have modified the printf() that was ...
2
votes
1answer
73 views

Binary Search Tree in C

I have implemented a BST from scratch. My aim is to draft better code and understand some pitfalls which I may have overlooked. It includes the following functionalities: Insert a new item. Find ...
4
votes
1answer
111 views

Arduino code powering horoscope generator

This code works, in the same way that a cardboard bicycle works until you cycle through a puddle. It powers a box that plays a sound file in sync with some lights on movement detected by a PIR sensor. ...
6
votes
2answers
50 views

Extracting information from a URI

I'm completely new to C and my first project is to create a simple cURL-like HTTP request client... but first, I need to create a function that can parse a URL. I've created this function, and it ...
5
votes
1answer
52 views

Wormhole - a Windows shim app written in C with no stdlib

My application compiles and seems to work correctly, but this is my first C project so I welcome any criticism. I developed this in Pelles C with no standard lib. Efficiency and optimizations are more ...
2
votes
1answer
55 views

Printing calculator - Stephen Kochan exercise

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' tells the program to set ...
3
votes
2answers
142 views

Delete an item from a linked list

I wrote this code to delete an item from a linked list. I checked it and it works, but I want to know if the logic could be written simpler or clearer. ...
4
votes
1answer
45 views

Anatomy of a string-reversal program with less coupling

I'm currently trying to improve my C understanding. Would you mind telling me if there are good/bad things that I did here? (I implemented a function to reverse a string in place). For example things ...
6
votes
1answer
74 views

A BrainF*ck-ish compiler in C

-ish because I removed the input functionality from the compiler. And, the compiler does not support nested loops I've been recently reading up on compilers and how they work. Although this doesn't ...
3
votes
1answer
55 views

Remove odd valued nodes from linked list

The function remove_odd is to remove odd valued nodes (surprise!!) from the linked list head. The code is very long and cryptic but it seems to work. Please help ...
2
votes
1answer
27 views

C function delimiates strings using a single character array

I am a complete noob to C and I've shied away from using such a powerful language due to it's large learning curve and other complicated mechanisms. For my first minor project I plan to create a small ...
2
votes
4answers
55 views

A function that reverses a string of characters

My problem is in writing a function reverse(s) that reverses the character string s, a line at a time. My code here works, I ...
5
votes
1answer
84 views

Brainf*** Interpreter in C

I posted a question on StackOverflow regarding this program. I ended up pretty much rewriting everything to get what is posted here. This turned into a two-day long project. I've been using Python for ...
1
vote
1answer
304 views

Number of interesting numbers between two given numbers

Please have a look into this problem: Little Dipu is a small kid and like all the other kids, he likes to play, but he plays with numbers (he is extraordinary you know). Nowadays Dipu has some ...
7
votes
3answers
252 views

Keeping integer addition within bounds

I have to read a int8_t from a buffer, read a uint8_t from the camera's current settings, add them together, keep new value ...
0
votes
1answer
24 views

Copy memory blocks of different sizes

Is there a better way than this to copy the values from source to destination when the blocks of memory you want to copy to and from are different sizes? Also considering you have no control over ...
2
votes
1answer
92 views

Constructing and maintaining a complete binary tree

Problem statement: Create and maintain a Complete Binary Tree in C. Include the following operations. Insert a given key and perform inorder Replace ALL occurrences of the given key ...
2
votes
4answers
109 views

C-string appender for buffers and strings

Is this C appender safe, and reasonably optimal? ...
3
votes
2answers
39 views

Program to evaluate powers of complex numbers

I'm trying to develop a simple program to evaluate integral powers of a complex number \$z\$ , that is, \$z^n\$, where \$z\$ is in the algebrical form \$a+i b\$ and \$n \in \mathbb{Z} ^{*} _{+}\$. ...
5
votes
1answer
67 views

“Laser treatment” SPOJ challenge

I am trying to solve this problem on SPOJ Brazil. I'm trying to approach the problem with a series of logical conditions and my code looks like this and it works perfectly. ...
2
votes
1answer
57 views

Readers-Writers problem in C

I would love some suggestions on this code of mine, pointers on overall design, code quality, optimization in terms of memory and speed. ...
5
votes
2answers
57 views

Converting from base-10 to word

The following code is used to convert a base-10 number to a base-N number, where N is a length of a given alphabet that contains characters of which a base-N number ...
1
vote
0answers
17 views

Entering base characters one-by-one for a List [closed]

This function should prompt the user to enter bases characters (a, g, c and t) one-by-one and then insert them in the List. ...