&
![]()
![]()
ça se simplifie en

c'est bien connu que x & x = x !
&
![]()
![]()
#include <stdio.h> int main(void) { printf("coucou\n"); return 0; }
Flanker :
c'est un fichier .h qui sert à décrire les fonctions écrites dans un autre fichier
par exemple
main.c contient#include <stdio.h> int main(void) { printf("coucou\n"); return 0; }
le compilateur ne connaît pas printf, donc il va regarder dans stdio.h le format et il va pouvoir compiler ton fichier main.c (sans savoir ce que contient printf) et après, il va pouvoir s'occuper de réunir le code correspondant à printf et celui de ton fichier
#include "include.h" blablablabla
type_retour ma_fonction(type1 arg1, type2 arg2, type3 arg3) { printf("glop !"); // et tu fais ce que tu veux avec tes arguments }
void swap(short *a, short *b) { short temp = *a; *a = *b; *b = temp; // Corrigé ; Merci Thepro (cf ./43) }
short a=10, b=20; swap(&a, &b); // a==20, et b==10
short *ma_fonction(...) { short tab[10]; ... return tab; }
typedef struct mastructure { type1 element1; type2 element2; type1 element3; }mastructure; mastructure fonction(void) { mastructure ms; ... ms.element1 = untruc; ... return ms; }
void swap(short *a, short *b) { short temp = *a; *a = *b; *b = temp; }
Returning structures is complicated and rarely useful
#include <stdio.h> int main(void) { int a=10; int b=20; a ^= b ^= a ^= b; printf("a=%d b=%d\n", a, b); }
$ gcc --version gcc (GCC) 3.3.6 (Debian 1:3.3.6-6)
$ ./test.exe a=20 b=10
#include <tigcclib.h> void _main(void) { int a=10; int b=20; a ^= b ^= a ^= b; printf("a=%d b=%d\n", a, b); }
$ tigcc --version tigcc version 1.3.0 built for TIGCC/*nix version 0.96 Beta 4 r1
void fonction(short tab[2][3]) { // } void _main(void) { short tab[2][3]; fonction(tab); // }
Thepro
: "pointeur=&pointé+12;" n'est pas possible !