Computer Science, asked by iamthebest9173, 11 months ago

stremp फंक्शन का उपयोग किये बिना दो स्ट्रिंग की तुलना (Comparison) किस प्रकार की जाती है? उदाहरण सहित बताइए।

Answers

Answered by Anonymous
2

strcmp() is a built-in library function and is declared in <string.h> header file. This function takes two strings as arguments and compare these two strings lexicographically.

// C program to illustrate

// strcmp() function

#include<stdio.h>

#include<string.h>

int main()

{

char leftStr[] = "g f g";

char rightStr[] = "g f g";

// Using strcmp()

int res = strcmp(leftStr, rightStr);

if (res==0)

printf("Strings are equal");

else

printf("Strings are unequal");

printf("\nValue returned by strcmp() is: %d" , res);

return 0;

Similar questions