Tagged Questions
7
votes
2answers
230 views
What could I have done better?
This is my first real program, though it has gone through a few major revisions. Anyhow, I am sure that there is a lot I could have done better, cleaner or safer.
Can anyone see anything I really ...
5
votes
4answers
273 views
Truthy assignments
I often argue with the voices about the correctness of having assignations within an if statement (or equivalent), meaning having this:
if($thing = someFunction()){
//do stuff
}
Instead of this:
...
4
votes
2answers
282 views
Human (Imperfect) array (card) shuffle written in C
ok, so I've got this humanoid_shuffle I wrote in python... And I've been wanting to learn C so as an exercise I ported it to C, as this is my first venture into C and even the idea's of memory ...
4
votes
2answers
167 views
Is this C game code OK? Structures and bitfield flags with some macros to handle them
I wrote some C code for working with some data for a game, I wanted to know what do you think and what could I do to improve it, what should I change, etc.
These are just some lines of the file, you ...
2
votes
4answers
1k views
Binary Multiplication in C
Question:Write an algorithm in C to do integer multiplication without using multiplication nor division operators.
Could I get a critique of the doMultiplication function? I know the rest of the code ...
2
votes
2answers
86 views
Need some advice and feedback on my C code calling Bash functions
My intent is to use Bash functions defined in functions.sh in a C program. I am doing this so that I don't have to rewrite the Bash functionality again in C. I want to use one common library for ...
2
votes
2answers
311 views
Defensive programming in C
I wrote a function (get_last_word_of) that takes a C string and a destination buffer, and then copies the last word into the buffer. The code was originally C++, and was changed into C later.
...
2
votes
1answer
498 views
Opinion on My atof
I am looking for feedback on coding style. I know this function already exists, and I would never use my version over a well tested one. I am just practicing. Your feedback helps me understand the ...
1
vote
3answers
149 views
Possible improvements for this small C program?
I'm learning C and today I wrote a program that displays info about my hardware on ubuntu.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char ch, file_name[25] = ...
1
vote
1answer
47 views
Request for review: Enhanced Concatenating Function
I would like to submit my enhanced concatenating function for your review. Originally, its' method signature is:
char *concat (const *char1, const *char2);
but after knowing that the calling code ...
0
votes
0answers
68 views
Hanoi Towers - need help with the code
I made an algorithm solving Hanoi Tower puzzles, for n disks and m pegs.
It uses lists as pegs, each list's element contains disks array - {0, 0, 0} means the peg is empty, {1, 2, 0} means the peg ...