Write a program to compare two strings without using the
strcmp() function
Answer Posted / shaiju . a
int str_cmp( const char *str1 , const char *str2)
{
while(*str1 != '\0')
{
if( *str1 == *str2)
{
str1++;
str2++;
}
else
break;
}
return *str1 - *str2;
}
| Is This Answer Correct ? | 64 Yes | 78 No |
Post New Answer View All Answers
What is the difference between array and pointer in c?
What is memcpy() function?
How can I get the current date or time of day in a c program?
Can a function argument have default value?
How can I get back to the interactive keyboard if stdin is redirected?
What is uint8 in c?
How can this be legal c?
Why are all header files not declared in every c program?
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
How can you allocate arrays or structures bigger than 64K?
largest Of three Number using without if condition?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
List the difference between a While & Do While loops?
In which layer of the network datastructure format change is done
What is return in c programming?