Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

condition

11 réponses
Avatar
John Ramm
Bonjour,

j'ai un comportement bizarre d'un programme..

char const a[] = "arf yop/bijoure";
do {


if ((a[i] != ' ') || (a[i] != '/'))

printf("%c", a[i]);

++i;

} while ((a[i] != 'e'));



normalement il devrait afficher:

arfyopbijoure



cependant ce n'est pas le cas. pq?



merci

1 réponse

1 2
Avatar
Emmanuel Delahaye
In 'fr.comp.lang.c', Yves ROMAN wrote:

if (a[i] != ' ' && a[i] != '/')

ou

if (!(a[i] != ' ' || a[i] != '/'))
Lapsus :

if (!(a[i] == ' ' || a[i] == '/'))


Oui, désolé. Je vois qu'il y en a qui ne dorment pas. C'est bien!

--
-ed- [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=cpp
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/


1 2