paladin
  • Member for 1 year, 3 months
  • Last seen more than a week ago
  • Halle, Deutschland
Generate mask for non zero (or inverse) nibbles in integer
2 votes

This might be faster than your solution. #include <stdio.h> typedef struct __attribute__((__packed__)) { unsigned int N0 : 4; unsigned int N1 : 4; unsigned int N2 : 4; unsigned ...

View answer
Check if a given string matches a wildcard pattern
2 votes

Move your main() to the bottom, so you don't have to declare other functions, it's also less prone to errors. '*' is not called a star, but it's called an asterisk. Instead of using an additional ...

View answer
A simple terminal-based trading game in C
2 votes

You may use a switch, but be informed that using break; to break the loop would not work (Instead you would have to use a goto to break the loop.); same applies to a nested for-loop (With additional ...

View answer
Optimize a tile rendering algorithm for Swing Canvas
2 votes

Example for an IndexColorModel. /* START */ public static final class GUI { public static final Color BLACK = new Color(0x00, 0x00, 0x00); public static final Color MAROON = new Color(...

View answer
Optimize a tile rendering algorithm for Swing Canvas
2 votes

You could either use the real Java console, but that would mean you have to recreate your entire application. If you really insist to use Swing, I would do it in another way. Create some custom print()...

View answer
Pong Game project
Accepted answer
1 votes

Code looks clean, some variables should maybe have a little bit better name, some comments would be nice, overall very good for your first game. Some points: You should use a package, this makes it ...

View answer
A case for GOTO
1 votes

In my personal opinion, using GOTO is totally acceptable. But regarding your example, your code looks not very optimized in the first place. Nevertheless, some tips for you when using GOTO. You should ...

View answer
this is my realloc version, is it good ? any suggestion are welcomed
0 votes

#include <stddef.h> #include <stdlib.h> void *ft_realloc(void *old_ptr, size_t old_size, size_t size) { if (size == 0 && old_ptr != NULL) { free (old_ptr); }...

View answer
Decode alphabet encoded message
-1 votes

You might use a decoding key, an array which has stored the encrypted values for each character, then you use a nested loop construction. This would shorten your code significantly and you might be ...

View answer
Library Management System OOP with c++( Part2 of a series )
-2 votes

unsigned int month; unsigned int day; unsigned int year; may also be written in one line unsigned int month, day, year; You use unsigned int, that's ok, but you should nevertheless use int, ...

View answer