Function Descriptions : strcmp (2024)

Function Descriptions : strcmp (1)
Chapter Contents
Function Descriptions : strcmp (2)
Previous
Function Descriptions : strcmp (3)
Next

strcmp


Compare Two Null-Terminated Strings
Portability:ISO/ANSI C conforming, UNIX compatible
SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
IMPLEMENTATION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO
SYNOPSIS
#include <string.h>int strcmp(const char *str1, const char *str2);
DESCRIPTION

strcmpcompares two character strings (str1 and str2) using the standard EBCDIC collating sequence. The return value has the same relationship to 0 as str1 has to str2. If two stringsare equal up to the point at which one terminates (that is, contains a nullcharacter), the longer string is considered greater.

RETURN VALUE

The return value from strcmp is 0 if the two strings are equal, less than 0 if str1 compares less than str2, andgreater than 0 if str1 compares greaterthan str2. No other assumptions shouldbe made about the value returned by strcmp.

CAUTION

If one of the arguments of strcmp is not properly terminated, a protection or addressing exceptionmay occur. If one of the arguments to the built-in version of strcmp is a constant, the compiler generates a CLC instruction to performthe entire comparison. If the variable argument is not null terminated, thecharacter-by-character comparison may perform as expected, but a comparisonby the CLC instruction may cause an addressing exception in rare cases.

IMPLEMENTATION

The compiler generates inline code for strcmp unless strcmp is undefined (by an #undef statement)to prevent this. The inline code may still call a library routine in specialcases.

EXAMPLE
#include <lcstring.h>#include <stdio.h>#include <stdlib.h>main(){ char command[20]; int n = 0; for(;;) { ++n; printf("Enter command # %d\n", n); puts("Enter quit to terminate/any other command to continue"); gets(command_; if (strcmp(command, "quit") == 0) break; /* Determine whether command is equal to quit. */ strlwr(command); if (strcmp(command, "quit") == 0) exit(0); puts("Did you meant to say quit? (Case is significant.)"); }}
RELATED FUNCTIONS

memcmp, strcoll, strncmp, strxfrm

SEE ALSO
Function Descriptions : strcmp (4)
Chapter Contents
Function Descriptions : strcmp (5)
Previous
Function Descriptions : strcmp (6)
Next
Top of Page

Function Descriptions : strcmp (8)

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.

Function Descriptions : strcmp (2024)
Top Articles
system-unavailable
What Is Windows Communication Foundation - WCF
55Th And Kedzie Elite Staffing
It's Official: Sabrina Carpenter's Bangs Are Taking Over TikTok
Minooka Channahon Patch
Palm Coast Permits Online
Odawa Hypixel
<i>1883</i>'s Isabel May Opens Up About the <i>Yellowstone</i> Prequel
Women's Beauty Parlour Near Me
How Far Is Chattanooga From Here
Espn Expert Picks Week 2
Baseball-Reference Com
Premier Boating Center Conroe
Vichatter Gifs
Conduent Connect Feps Login
De Leerling Watch Online
Walthampatch
The most iconic acting lineages in cinema history
Lima Funeral Home Bristol Ri Obituaries
Eka Vore Portal
Most McDonald's by Country 2024
Skyward Login Jennings County
Fsga Golf
Holiday Gift Bearer In Egypt
Gotcha Rva 2022
Drift Hunters - Play Unblocked Game Online
Breckiehill Shower Cucumber
Renfield Showtimes Near Paragon Theaters - Coral Square
Craftsman Yt3000 Oil Capacity
Darktide Terrifying Barrage
Gideon Nicole Riddley Read Online Free
Ket2 Schedule
Msnl Seeds
Latest Nigerian Music (Next 2020)
Main Street Station Coshocton Menu
Uc Santa Cruz Events
Dollar Tree's 1,000 store closure tells the perils of poor acquisitions
Myanswers Com Abc Resources
Leena Snoubar Net Worth
Hireright Applicant Center Login
What Is A K 56 Pink Pill?
11526 Lake Ave Cleveland Oh 44102
2132815089
SF bay area cars & trucks "chevrolet 50" - craigslist
Post A Bid Monticello Mn
Valls family wants to build a hotel near Versailles Restaurant
Iman Fashion Clearance
Tyco Forums
Horseneck Beach State Reservation Water Temperature
Coleman Funeral Home Olive Branch Ms Obituaries
Bumgarner Funeral Home Troy Nc Obituaries
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 6063

Rating: 5 / 5 (80 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.