Write a C function that takes two strings (character arrays) as input and return 1 if they are equal and return 0 if they re not. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal in the same order.
#include<stdio.h>
int equalornot(char[],char[]);
int main()
{
char str1[100],str2[100];
printf("Enter a string1: ");
gets(str1);
printf("Enter a string2: ");
gets(str2);
int res;
res=equalornot(str1,str2);;
if(res==1)
printf("Strings are equal.");
else
printf("Strings are not equal.");
return 0;
}
int equalornot(char str1[], char str2[])
{
int i,len1=0,len2=0,count=0;
for(i=0;str1[i]!='\0';i++)
len1++;
for(i=0;str2[i]!='\0';i++)
len2++;
if(len1!=len2)
return 0;
else
{
for(i=0;str1[i]!='\0';i++)
{
if(str1[i]==str2[i])
count++;
}
if(count==len1)
return 1;
else
return 0;
}
}




Write a C function that takes two strings (character arrays) as input and return 1 if...
Write a C function that takes two strings (character arrays) as input and return 1 if they are equal and return 0 if they re not. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal in the same order.
c++ Write a function has Match that takes 3 parameters: 2 arrays of strings and an int that represents the length of each array The function returns true if at any position, the two arrays have the same string, false if not. For example: {"a", "b", "cat", "d"} and {"1", "2", "cat", "4"} would match
2. Write a function convstrs that will receive a cell array of strings and a character (either 'U' or 'L') as input arguments. If the character is 'U', it will return a new cell array with all of the strings in uppercase. If the character is 'L', it will return a new cell array with all of the strings in lowercase. If the character is neither 'U' nor 'L', or if the cell array does not contain all strings, the...
Write a function with the header: function [out] = myDataTypeChecker(A,B) takes two matrices A and B and has the following behavior (in this order): 1) if either A or B contains a “Not a Number”, the function should return -1. 2) if either A or B contains an +/-Infinity, the function should return -2 3) if either A or B is a character array, the function should return -3 4) if both A and B are logical arrays, the function...
MATLAB Write a function maxContent(arr) that takes a cell array arr as input and returns the longest string and largest number in arr. If there are two character arrays of same length, the function should return one of them. Assume that integers in the cell array are nonnegative.
write a function which takes a string argument and a character argument. It should return a truth value (int 0 or 1), 0 if the string does not contain the character, and 1 if the string does contain the character. Do not use a built-in library for this. Again, call this function and its variables whatever you deem appropriate. The main function of the program should accept a single character followed by Enter. Then, it will read lines until the...
Write a function that takes an array of C-strings as a parameter and the number of elements currently stored in the array, and returns a single C-string pointer that is the concatenation of all C-strings in the array. Note: The function must take 2 parameters and return "char *". Any other ways will cause some deduction of points.
programing C,already write part of code
(a) Write a function print.array that receives an array of real numbers and the number of el stored in the array. This function must display the elements of the array in order with each one on a line by itself in a field width of 7 with two decimal places. (See sample output. Recall the format specifier would be "%7.21f"). (b) Sometimes we want to treat an array as a mathematical vector and compute...
write C code that uses pointers, arrays, and C strings. 3. Write a function called pow_xy. The function should be passed 2 parameters, as illustrated in the prototype below. int pow_xy(int *xptr, int y); Assuming that xptr contains the address of variable x, pow_xy should compute x to the y power, and store the result as the new value of x. The function should also return the result. Do not use the built-in C function pow. For the remaining problems,...
Write a method that takes two arrays of integers and return and array that is the union of both arrays. For instance, the first array contains (1,2,3), the second array(4,5,6), the returned array should contain (1,2,3,4,5,6) (3.5 points) Write a method that takes and an array and return the reverse of that array. For instance, if the array is (1,2,3), the returned array should be (3,2,1) (3.5 points)