Skip to content

Instantly share code, notes, and snippets.

@ArnonEilat
ArnonEilat / columnSort.c
Last active December 10, 2015 17:58
Sort of a column in two dimensional array. Usage example included. I will add documentation someday.
#include <stdio.h>
#include <stdlib.h>
#define COLUMNS_NO 3
void sort_column(char matrix[][COLUMNS_NO], int lines_no, int col) {
int i, j;
char temp;
for (i = 0; i < lines_no - 1; i++) {
for (j = 0; j < lines_no - 1 - i; j++) {
@ArnonEilat
ArnonEilat / twoDimQS.c
Created January 6, 2013 23:59
Implementation of quick sort to sort an two dimensional array. Usage example included.
#include <stdio.h>
#include <stdlib.h>
#define N 4
void swap(int *a, int *b) {
int temp;
temp = *a;
*a = *b;
*b = temp;
}
@ArnonEilat
ArnonEilat / linkedList.c
Created January 6, 2013 23:49
Simple C implementation of linked list with pointer to the first node and pointer the last node. Usage example included.
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int info;
} DATA;
typedef struct node {
DATA data;
struct node * prev;
@ArnonEilat
ArnonEilat / CircularlyLinkedList.c
Created January 6, 2013 23:34
Very simple circularly linked list implementation in C. Usage example included.
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int info;
} DATA;
typedef struct node {
DATA data;
struct node *next;
@ArnonEilat
ArnonEilat / singlyLinkedList.c
Last active November 10, 2023 21:52
Very simple singly linked list implementation in C with usage example.
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int info;
} DATA;
typedef struct node {
DATA data;
struct node* next;
@ArnonEilat
ArnonEilat / stack.c
Created January 6, 2013 23:02
Very simple stack implementation in C with usage example.
#include <stdio.h>
#include <stdlib.h>
#define FALSE 0
#define TRUE 1
typedef struct {
int info;
} DATA;