program for comparing 2 strings without strcmp()

Answer Posted / ankitecian

int StrCmp(const char *_input1, const char *_input2)
{
int _cntr1 = 0;
int _flg = 0;
while(*(_input1 + _cntr1) != NULL || *(_input2 + _cntr1) !
= NULL)
{
if(*(_input1 + _cntr1) != *(_input2 + _cntr1))
{
_flg = -1;
}
_cntr1++;
}
return _flg;
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you allocate arrays or structures bigger than 64K?

900


What is a char c?

807


Compare interpreters and compilers.

827


What is a sequential access file?

872


Explain how can I pad a string to a known length?

899


What is the right type to use for boolean values in c? Is there a standard type?

797


What does malloc () calloc () realloc () free () do?

792


Explain what is the stack?

842


Is swift based on c?

860


What is the purpose of sprintf?

821


What is size of union in c?

766


Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250

1744


Is javascript written in c?

793


What are c header files?

785


If null and 0 are equivalent as null pointer constants, which should I use?

822