Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Comparing Strings | Common String Operations
Practice
Projects
Quizzes & Challenges
Quizer
Challenges
/
C Strings
Seksjon 3. Kapittel 4
single

single

bookChallenge: Comparing Strings

Sveip for å vise menyen

After learning how to compare strings in C using standard library functions, you are ready to apply these concepts in a practical scenario. Comparing strings is a common operation, whether you are checking for equality or determining which string comes first in dictionary order. This challenge will reinforce your understanding and help you interpret the results of string comparison functions.

Oppgave

Swipe to start coding

Practice using string comparison functions in C by implementing a function that checks if two strings are equal, or determines which one is lexicographically greater.

  • Use a string comparison function to compare str1 and str2.
  • If the strings are equal, return 0.
  • If str1 is lexicographically less than str2, return -1.
  • If str1 is lexicographically greater than str2, return 1.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 4
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

some-alt