C is a medium level general purpose compiled language. It is an ALGOL style language, meaning that it has block structures, subroutines, and variable scope, among other things. Many current languages are heavily influenced by C, such as Java, Perl, PHP, and obviously C++ and Objective-C. It was ...
1
vote
2answers
55 views
Feedback on text parsing and control structures
I threw together this C program today to handle a bioinformatics data processing task. The program seems to work correctly, but I wanted to know if anyone has suggestions regarding how the input data ...
0
votes
0answers
36 views
String sorting based on first latter of string [closed]
How can I sort String array based in first Letter of string?
2
votes
3answers
105 views
Splitting a string into tokens in C
I am trying to improve my skill in C, and this time by getting away from strtok. The following code splits the input string into a token_list, an array of strings.
#include <stdio.h>
#include ...
0
votes
1answer
65 views
std::lock implementation in C with pthreads
I messed a little bit with pthreads and needed an alternative to the C++11 function std::lock (2 args are enough), this is what I came up with:
void lock(pthread_mutex_t* m1, pthread_mutex_t* m2) {
...
2
votes
3answers
101 views
Are there any obvious buffer overflow dangers in this code?
after hours of working i've finally finished my first C log parsing program!(previously was a bash script, now it is C) and although I think i've gotten most everything, I was just wondering if you ...
0
votes
0answers
17 views
Multiplication Operation of Blocks - GCM. [closed]
I created a question on stack overflow for this. I guess this might be the place to have it posted instead. Please look at
http://stackoverflow.com/questions/10655026/gcm-multiplication-implementation
...
0
votes
0answers
11 views
Using ntohs() with stringstream [migrated]
I have a question on how to use ntohs() when I am reading data from stringstream.
For the following code:
read(ns, buf_receive, BUFFER_SIZE);
stringstreams ss(buf_receive);
char[2] a;
short int b;
...
0
votes
0answers
45 views
8 bit CRC in C code (pseudo code) [closed]
Here is my c-based psudo code for doing 8 bit CRC on chars as they arrive.
Its designed straight from wiki examples.
http://en.wikipedia.org/wiki/Cyclic_redundancy_check
Feel free to review this ...
1
vote
1answer
59 views
Ring buffer in C tail pointer issue (for audio streaming)
I am currently writing an embedded application for audio streaming purposes. The embedded app will receive audio packets being sent over wifi, buffer the packets, then send the audio data over to a ...
1
vote
1answer
51 views
Review my open addressed hash table
I'm attempting to implement various data structures and algorithms to better learn C. I would appreciate comments on style, correctness of the implementation, memory management, etc.
One specific ...
1
vote
2answers
77 views
Improving file reading
Iam programing in C language and have created the below functions to read files. There are 2 functions that i can use to read files. I wanted to know how i can further improve these two in terms of ...
1
vote
1answer
169 views
Improving this date-time function in C++
Am looking for ways to enhance this function in C++.
The function gets a date and it returns
the total number of seconds since the epoch (01/01/1970).
Do you have any suggestion regarding the ...
4
votes
2answers
142 views
Reversing a linked list by iteration and recursion
From my original question: http://stackoverflow.com/questions/10486743/is-my-implementation-of-reversing-a-linked-list-correct
I'm a beginner at C and I'd like to know about style, and correctness of ...
-1
votes
1answer
66 views
Will this C program run?
The purpose of this program is to allow the robot to move until the bumper switch hits the wall and then the robot should go back for 2 seconds and then take take a right for 3 seconds then go forward ...
4
votes
3answers
191 views
Is this C code secure and correct?
This is my code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <termios.h>
#include <sys/types.h>
#include ...