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
4answers
50 views

Implementing Caeser 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
9 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 ...
3
votes
3answers
29 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
30 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
66 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
103 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
47 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 ...
-1
votes
0answers
16 views

Switch case for menu of pay rates [closed]

I am trying to make a program that prompts the user a menu of options like this ...
5
votes
1answer
49 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
50 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
131 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
41 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
68 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
45 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
26 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
48 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
81 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
291 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
251 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
22 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
84 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
106 views

C-string appender for buffers and strings

Is this C appender safe, and reasonably optimal? ...
3
votes
2answers
38 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
66 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
45 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. ...
3
votes
2answers
39 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
15 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. ...
5
votes
2answers
149 views

Edge cases for simulated malloc function

I'm trying to simulate the malloc function in C by using mmap and having 2 linked lists to act as memory blocks. The program ...
2
votes
1answer
44 views

Array-based FIFO queue in C

I have this "generic" implementation of an array-based FIFO-queue. As I have written very little code in C, I don't have an idea what to ask, so feel free to tell anything that comes to mind. ...
11
votes
2answers
82 views

HTML/XHTML/XML tokenization

I want to write a library to parse any valid or invalid HTML-like things. First of all, I am trying to build a lexer. Here is what I did; ...
1
vote
1answer
43 views

Minimum sum of numbers

The code reads an input with numbers and find the sum with the minimum difference of the first two big numbers. The sums are three. Is there is any way to make the code cleaner? (Note that I don't ...
5
votes
4answers
496 views

C Doubly Linked List

It works, but it seems a bit long winded. I'd like some critiquing. ...
2
votes
1answer
26 views

Printing simple histogram horizontally

I am new to programming and want to know if this is really bad code. I know my variable names may seem arbitrary but I spent some time trying to get them right. I am struggling on that. Would you do ...
2
votes
1answer
38 views

Byte-to-binary conversion function

My implementation of a binary-to-bits converting function: ...
2
votes
1answer
23 views

Can I be checking that buttons are pushed in a better way?

I made a panel of buttons which run commands when pushed. In order to not have the command run on every loop if the button is held down, I am comparing the button to a previous state and only run if ...
3
votes
1answer
36 views

Reading a file into memory

Can you review below code for performance and stability considerations? It is supposed to take a filename or NULL. If it is a filename, read given file into memory. ...
3
votes
1answer
36 views

Blinking LED code at a particular frequency [closed]

I wrote a function for interacting with my PIC16F1788. The code sends pulses out the RC4 port at a specific frequency, to make ...
0
votes
1answer
55 views

Optimizing Diwali Lights problem in C

I was trying to solve the Diwali Lights challenge on HackerRank. Problem Statement On the eve of Diwali, Hari is decorating his house with a serial light bulb set. The serial light bulb set ...
1
vote
2answers
44 views

Optimizing the runtime of the bisection method

For those who aren't familiar with the bisection method for finding the root of a function (i.e. finding where \$f(x) = 0\$) the basic idea is: take a function \$f(x)\$ and an interval \$[a,b]\$ if ...
0
votes
1answer
20 views

Moving between two angles in a set amount of time [closed]

I need to slowly change from one angle to another angle over a certain amount of time, using the shortest path between them. I have a function that accepts four parameters — the start and end angles ...
3
votes
1answer
40 views

Dynamic array implementation

I would like to use code below for general purpose dynamic array implementation in my future code. How does it look? array.h: ...
2
votes
1answer
37 views

Implementing dirpath(3p) and fdirpath(3p) functions

I'm implementing a dirpath and fdirpath functions, which allow to retrieve path from the directory handle (or its descriptor). ...
1
vote
1answer
50 views

Data structure for inserting and replacing data in list

I have a list of key value pairs, that is used as an intermediate store for building URL parameters or JSON data. Currently this is done with a linked list: ...
1
vote
1answer
53 views

ROT13 algorithm in C

I am trying to learn C and I came across the ROT13 scrambling system used to store some passwords. Assuming the user types everything in correctly (uses 1 argument, uses a string not an int, etc.) ...
2
votes
2answers
61 views

Prime factors of a number in C

The following is code on "prime factors of a number". Any suggestions to optimize the code? It runs for a pretty long time for inputs like 35068499. I also want the code to take 10 digit numbers as ...
7
votes
1answer
46 views

Restrictive stupid shell

I'm attempting to create a replacement shell for /bin/bash, that only permits commands defined by a read only config file. These commands will be run by absolute paths, and take no arguments. I'm not ...
2
votes
1answer
53 views

HackerEarth Crazy kangaroo challenge

I want to find the lowest hop count from source to destination. The challenge, in summary: The first line contains the number of test cases T, 1 ≤ T ≤ 100000. The next T lines each contains ...
3
votes
1answer
39 views

Network byte order to host byte order

While doing a little project involving sniffing packets, I found myself programming a cross platform network to host byte order and host to network byte order, this is my first time developing a ...
4
votes
1answer
28 views

K&R Exercise 1-20: tabs to spaces

I'm learning C with K&R 2nd Ed. I've just completed the exercise 1-20 and I would know if my code is correct (i.e. answering the question) and if my style is not too bad. Or just some feebacks to ...