This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
// MACRO PRINTB | |
#define PRINTB(x) \ | |
for(int i=(sizeof(x)*8-1) ; i>=0 ; i--) { \ | |
(x & (1 << i)) ? printf("1") : printf("0") ; \ | |
if (i % 4 == 0) { printf(" "); } \ | |
} \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
File: Agenda.c | |
*/ | |
#include "Agenda.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
void addLast(Agenda _this, Persona persona) { | |
AgendaNode node; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "search.h" | |
unsigned int linear_search(int* array_items, unsigned int size, int search_item) { | |
unsigned int i; | |
for(i=0; i<size; i++) { | |
if(array_items[i] == search_item) { | |
/* elemento encontrado, devolvemos el indice 'i' */ | |
return i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "array.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define MAX(x, y) (((x) > (y)) ? (x) : (y)) | |
ARRAY array_new(unsigned int size) { | |
ARRAY s_array; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.UIManager; | |
public class LookAndFeel { | |
public static enum LAF { | |
CROSS, | |
SYSTEM, | |
METAL, | |
NIMBUS, | |
MOTIF, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "sort.h" | |
#include <stdlib.h> | |
#define SWAP(a, b, tmp) ((tmp)=(a), (a)=(b), (b)=(tmp)) | |
void bubble_sort(float*array, int size) { | |
int i, j; | |
float tmp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Wiring | |
01 3.3V DC POWER --------------- + | |
06 GROUND ---------------------- GND | |
11 GPIO17 (GPIO_GEN0) ---------- CLK | |
12 GPIO18 (GPIO_GEN1) ---------- DT | |
13 GPIO19 (GPIO_GEN2) ---------- SW | |
Compile: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
void string_split(char * string, char sep, char *** r_array_string, int * r_size) { | |
int i, k, len, size; | |
char ** array_string; | |
// Number of substrings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copy the 'source' file to 'dest'. If 'dest' exists it will be | |
* overwritten. | |
* | |
* @param source Path to the source file. | |
* @param dest Path to the destination file. | |
* @return Number of bytes copied or -1 if cannot copy | |
* file. | |
*/ | |
int file_copy(char * source, char * dest) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> /* Needed for struct timespec */ | |
/** | |
* Pauses the execution of a program without affecting the signals. | |
* Note: Compile with '-std=gnu11'. | |
* | |
* @param millis Milliseconds to sleep. | |
*/ | |
void millisleep(int millis) | |
{ |
OlderNewer