cancel
Showing results for 
Search instead for 
Did you mean: 

meaning

Jessy J
Associate II

Posted on July 05, 2018 at 11:54

Bonjour tout le monde

Je veux comprendre ce que cette ligne signifie s'il vous plaît?

Merci d'avance

3 REPLIES 3
aa bb_2
Associate II
Posted on July 05, 2018 at 15:00

It tries to compare no characters in two strings (starting at buf and STR) for equality. The zero length is a bit nonsensical.

Have you at least read a chapter or two on C strings, in something like the K&R manual?

I think it is important to master programming in C before attempting to move on to Embedded C

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Yannick Dannel
Associate II
Posted on July 05, 2018 at 15:43

Salut,

Pour faire court, ton test ne sert à rien.

La fonction strncmp compare les n premier caractère des 2 chaines. Dans ton cas, elle compare 0 caractère entre la chaîne pointée par buf et la chaîne STR. Cette fonction retourne 0 si la comparaison est identique.

Dans ce cas là, la fonction retourne dans tous les cas 0 puisque la comparaison se fait sur 0 caractère.