bonjour,
y a-t-il en C une variable (int,float,double...) numérique (pas de char, bool...) qui serait codée sur un seul bit? une variable binaire quoi?
merci
bonjour,
y a-t-il en C une variable (int,float,double...) numérique (pas de char, bool...) qui serait codée sur un seul bit? une variable binaire quoi?
merci
"The most important thing in the kitchen is the waste paper basket and it needs to be centrally located.", Donald Knuth
"If the only tool you have is a hammer, every problem looks like a nail.", probably Abraham Maslow
FAQ-Python FAQ-C FAQ-C++
+
il n'y a pas de booleen en C...
On se sert de int ou short (ou de char si on veut economiser la memoire)
si je comprends bien char est ce qui est de plus petit?
oui
par definition en C
sizeof(char) == 1
7.16 Boolean type and values <stdbool.h>
1 The header <stdbool.h> defines four macros.
2 The macro
bool
expands to _Bool.
3 The remaining three macros are suitable for use in #if preprocessing directives. They
are
true
which expands to the integer constant 1,
false
which expands to the integer constant 0, and
_ _bool_true_false_are_defined
which expands to the integer constant 1.
4 Notwithstanding the provisions of 7.1.3, a program may undefine and perhaps then
redefine the macros bool, true, and false.222)
souviron34 aurait dû préciser qu'il n'y a pas de booléen en C90. Par ailleurs, les booléens de C99 ne sont rien d'autre que des entiers déguisés.
Thierry
"The most important thing in the kitchen is the waste paper basket and it needs to be centrally located.", Donald Knuth
"If the only tool you have is a hammer, every problem looks like a nail.", probably Abraham Maslow
FAQ-Python FAQ-C FAQ-C++
+
Si je me plante pas on faire ça: "int nb:1;" pour dire qu'on utilise qu'un seul bit.
(Je sais pas vraiment ce que ça fait en mémoire. De toute façon réserver un seul bit c'est pas possible, si ?).
Non tu confonds : http://www.linux-kheops.com/doc/ansi-c/node90.htm
Merci pour le lien.
Ça va me servir en robotique tout ça :]
Partager