C is a medium level general purpose compiled language.

learn more… | top users | synonyms

-1
votes
0answers
24 views

Can anyone check what's wrong with my code? [closed]

#include <stdio.h> #include <stdlib.h> #define MAX 100 typedef struct aluno { char nome[81]; char matricula[8]; char turma; float p1, p2, p3; } Aluno; void imprime_aprovados (int n, ...
2
votes
1answer
42 views

lightweight packet sniffer review

This is a simple packet sniffer that turns on LEDs when there's network activity. It works by picking up filters in a configuration file and listen for activity in those filters. When there's a ...
1
vote
1answer
48 views

Can this solution to Project Euler #15 be improved?

I'm not a C programmer, just wanted to make a fast solution to the problem. Here's my code: #include <stdio.h> #define SIZE 21 // grid size + 1 ...
3
votes
2answers
58 views

Another stack implementation (in C)

I just started learning C and the online book contained the exercise 'implement a stack'. So I did, but thought I'd put it here, because I still don't feel comfortable with pointers. So here it is: ...
2
votes
0answers
15 views

Fast popcount on Intel Xeon Phi

I'm implementing an ultra fast popcount on Intel Xeon® Phi®, as it's a performance hotspot of various bioinformatics software. I've implemented five pieces of codes, #if defined(__MIC__) #include ...
2
votes
3answers
77 views

One function two functionalities or two functions each with one functionality

Within our project we've used a lot of boolean setOutputValue(char pinNumber, boolean pinValue) kind of functions. Within those functions we do the following (for example): hardware_layer: #define ...
1
vote
1answer
92 views

Sorted trie implementation in C

I wanted to store some dictionary data (key/value pairs of strings) in C, and decided to use a trie. I found what looks like a good implementation here, along with some nice notes. In this ...
-2
votes
1answer
29 views

! operator used with int inside if statement [closed]

I am trying to understand a bit of code, and i am not able to understand how this not operator works... if(choice==1){ for(i=0;i<4;i++){ for(j=0;j<4;j++){ for(k=0;k<4;k++){ ...
0
votes
0answers
14 views

D3D COM Object Pooling

I'm using the following pattern to pool D3D objects globally in my application. Is it a good idea (alternatives)? Is it thread-safe? CComPtr<ID3D11Texture2D> create_texture(const ...
2
votes
2answers
158 views

C try/catch macros

I've created simple try/catch macros that now I'd like to promote to wider use in my projects. I would have really liked to be able to do without global variables but I have not found any way to do ...
1
vote
1answer
69 views

Singly Linked List (strings only)

This is my attempt at constructing a singly-linked-list with basic functions. I initially tried to build the whole list as a series of nodes, but ran into problems when trying to remove or pop ...
0
votes
0answers
63 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 ...
0
votes
1answer
97 views

Can anyone make this code shorter IF POSSIBLE

My program has to decrypt ciphertext. It has to try all possible 26 shifts and store each in an array so that I calculate the frequencies of each array and find the highest frequency, in which that ...
0
votes
1answer
42 views

Basic Linked list

I am learning C from K.N. King and at ch-17, I covered linked list and wrote a code to add data in the ascending order in the linked list which is opposite to found in the book (In the book, it store ...
-1
votes
0answers
33 views

Hanoi Tower iterative - ugly solution [closed]

The requirements are that I have to make this algorythm iterative, and use list as rods. Each rod (list's element) has array inside containing disks. If array is like {1,2,3,4,5}, then the rod ...

1 2 3 4 5 22
15 30 50 per page