1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
amm1812
3 years ago
7

Explain what the problems with the implementation of the function are, and show a way to fix them.// return true if two C string

s are equalbool match(const char str1[], const char str2[]){bool result = true;while (str1 != 0 && str2 != 0) // zero bytes at ends{if (str1 != str2) // compare corresponding characters{result = false;break;}str1++; // advance to the next characterstr2++;}if (result) {result = (str1 == str2); // both ended at same time?}return( result );}int main(){char a[10] = "pointy";char b[10] = "pointless";if (match(a,b)){cout << "They're the same!" << endl;}}
Computers and Technology
1 answer:
Nataly [62]3 years ago
7 0

Answer:

The code is not dereferencing the pointers. You have to place an asterisk in front of the pointer to read the value the pointer points to.

Explanation:

So "if (str1 != str2)" must be "if (*str1 != *str2)".

likewise:

   while (*str1 != 0 && *str2 != 0)

and

     result = (*str1 == *str2);

You might be interested in
Whats the answer to this question?
Naddika [18.5K]
Eat a a dong dong edi35(
6 0
3 years ago
Monica is teaching herself to paint. What web resource would be the most helpful
strojnjashka [21]

Answer:

Video Tutorial

Explanation:

The others don’t make sense.

3 0
3 years ago
Network a0 is a process by which several protocols evolve to form a single product.
mafiozo [28]

Answer:

Convergent network

Explanation:

In networking, computers devices are connected together to communicate and share resources. Devices like routers and switches are examples of intermediate network devices and computers, smartphones, tablets and IP phones are all examples of end devices in a network.

In the past, dedicated networks are installed for separate voice, text and video packets. But as information technology evolves, one network is used for all three packets. This network is called convergent network.

6 0
2 years ago
What is the answer ??​
Natali5045456 [20]

<em>=</em><em> </em><em>Option</em><em> </em><em>b</em><em> </em><em>Minicomputer ..........</em>

3 0
2 years ago
Read 2 more answers
Consider the code fragment below (with nested loops). int sum = 0;for (int i = 1; i &lt; 5; i++) for (int j = 1; j &lt;= i; j++)
sammy [17]

Answer:

Option d is the correct answer for the above question.

Explanation:

  • The first loop of the program has a second loop and then the statement. In this scenario, the second loop executes for the value of the first loop and the statement executes for the value of the second loop.
  • The first loop executes 4 times, Then the second loop or inner loop executes n times for the n iteration of the first loop, for example, 1 time for the first iteration of the first loop, 2 times for the second iteration of the first loop and so on.
  • Then the inner loop executes (1+2+3+4) iteration which gives the result 10 iterations.
  • The sum initial value is 0 and the "sum++", increase the value of the sum by 1.
  • So the value of the sum becomes 10 after completing 10 iterations of the inner for loop.
  • Hence the 10 will be the output. So the Option d is the correct answer while the other is not.
3 0
3 years ago
Other questions:
  • You can click a web page title on the _____ list to return to that page.
    10·1 answer
  • ____ refers to data, applications, and even resources stored on computers accessed over the Internet. Answer
    5·1 answer
  • Many people keep time using a 24 hour clock (11 is 11am and 23 is 11pm, 0 is midnight). If it is currently 13 and you set your a
    10·1 answer
  • Jim is in the market for a car that will last for the next 10 years and has saved up some money for the purpose of a car. What’s
    8·2 answers
  • Write a program that calculates the total amount of a meal purchased at a restaurant by a customer. The program should ask the u
    15·1 answer
  • This isn't a question
    8·1 answer
  • To ensure that comments identify the initials of the person making changes, you would need to _____.
    5·2 answers
  • WILL GIVE MORE POINTS, PLEASE HELP!!!
    11·1 answer
  • If I could make a Short Film on any topic it would be...how could that film change the world?
    9·1 answer
  • An embedded system describes computing technology that has been enclosed in protective shielding for security reasons. True or f
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!