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
typedef struct | |
{ | |
unsigned int id; | |
Params *p; | |
} | |
pth; | |
void treatments(void *param, unsigned long s) | |
{ | |
//------------// |
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
{ | |
int a = 1; | |
int b = 2; | |
{ | |
int a = 3; // Ce 'a' est complètement différent du premier 'a' | |
a += 10; // Cherche un 'a' dans ce scope, il est trouve un (celui qui vaut 3). | |
int c = 5; | |
printf("%d\n", a); // Donne 13 | |
printf("%d\n", b); // Donne 2. Ici il ne trouve pas de 'b' déclarer dans ce scope mais il cherche dans le scope précédent et trove 'b'. | |
printf("%d\n", c); // Donne 5. |
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
//: clang -DHAVE_INLINE -O3 randgsl.c -o randgsl -lgsl -lgslcblas | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include <gsl/gsl_rng.h> | |
#include <gsl/gsl_randist.h> | |
int main(int argc, const char *argv[]) |
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
void create_assembled_pool(Params *p, double **pool, int divpool, double fert) | |
{ | |
// define and initialize the ecosystem list | |
//----------------------------------------- | |
sll ecosys; | |
sll_init(&ecosys,(void*)free_species); | |
// create the basal resources | |
//--------------------------- | |
basal(p,&ecosys,fert); |
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
def getX(i): | |
return int(-0.5 + 0.5 * sqrt(1 + 8 * (i - 1))) + 2 | |
def getY(i): | |
return getX(i) * (3 - getX(i)) / 2 + i - 1 | |
def getXY(i): | |
return (getX(i + 1) - 1, getY(i + 1) - 1) |
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
// clang -O3 -DHAVE_INLINE rngint.c -o rngint -lgsl -lgslcblas | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include <gsl/gsl_rng.h> | |
#include <gsl/gsl_randist.h> | |
// Get an integer in the [a,b) semi-closed range. |
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
// clang folders.c -o folders | |
// Creating folders with system calls to mkdir | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main() | |
{ | |
const int layer1 = 5; |
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 <stdlib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
int a = 5; | |
int *b = &a; | |
printf(" a = %d\n", a); | |
printf(" &a = %p\n", &a); |
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
//: clang -Wall pause.c -o pause | |
#include <stdlib.h> | |
#include <stdio.h> | |
// Wait for the user to press enter to continue. | |
void pause(); | |
int main() | |
{ |
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
// Slow -> O(n). Return 1 if a node was removed, 0 otherwise. Untested :P | |
int isll_rm_tail(isll *l) | |
{ | |
if (l->head == NULL) | |
{ | |
return 0; | |
} | |
if (l->head == l->tail) | |
{ | |
return isll_rm_next(l, NULL); |