Skip to content

Instantly share code, notes, and snippets.

@erenon
erenon / listn.c
Created November 23, 2010 09:41
insert after n
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _list {
int value;
struct _list *next;
} list;
@erenon
erenon / book.c
Created November 23, 2010 08:39
book list
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _book {
char author[50];
int page;
int is_sentinel;
struct _book *next;
@erenon
erenon / doublelinked.c
Created November 19, 2010 20:46
Simple double linked list implementation in C
#include <stdio.h>
#include <stdlib.h>
#define SENTINEL_VALUE -1
typedef struct _list {
int value;
struct _list *prev;
struct _list *next;
} list;
@erenon
erenon / pggyak-kzh-2.c
Created November 8, 2010 22:12
pggyak-kzh-2.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *trim(char *str) {
int i=0, spbefore=0, slen=0, spafter=0;
char *newstr;
slen = strlen(str);
@erenon
erenon / pggyak-kzh-1.c
Created November 8, 2010 22:11
pggyak kzh 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *filter(char *source, char *haystack) {
int i,j;
int nlen, cur, filter_flag;
char *nstr;
nlen = 0;
@erenon
erenon / probaNZH_f0.c
Created October 28, 2010 20:25
probaNZH f0
#include <stdio.h>
#include <stdlib.h>
struct ablak {
int a;
int b;
int c;
int d;
char e[50];
};
@erenon
erenon / probaNZH_f3.c
Created October 28, 2010 20:09
probaNZH f3
#include <stdio.h>
#include <stdlib.h>
int *evszamok(char k[], int *meret) {
int i=0, j=0, state=0, evszam = 0, m=0, cm=0;
int *evszamok = NULL, *evszamok2 = NULL;
while(k[i]){
switch(state){
case 1: //1 jegy?
@erenon
erenon / probaNZH_f2.c
Created October 28, 2010 20:09
probaNZH f2
#include <stdio.h>
int main(){
int m, m2, in, part, addm;
m=1;
m = m<<16;
m -= 1;
m2 = 1;
m2 = m2<<8;
m2 -= 1;
@erenon
erenon / probaNZH_f1.c
Created October 28, 2010 20:09
probaNZH f1
#include <stdio.h>
#include <math.h>
int main(){
int a,b;
double c;
a=1;
for(a=1;a<10000;a++) {
for(b=a;b<10000;b++) {
@erenon
erenon / betuszuro.c
Created October 21, 2010 13:03
[Proggyak I] Betűszűrő
/**
* Betuszuro
*
* Beker ket szot, es kiirja azokat a karaktereket,
* melyek csak az elsoben szerepelnek
*
* @todo source_unique and source_filter violates DRY.
*/
#include <stdio.h>