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
How do air and ocean currents affect climate
Nadya [2.5K]

Answer:

bc there are warm and cold ocean currents for example the current by Florida is going to be warmer then the one by Antarctica.

8 0
4 years ago
Read 2 more answers
Are lenovo margins expected to be stable in the china operations
lisov135 [29]

Yes

Lenovo Group Limited is the world’s number 3 PC brand. It has gained the operating margins at the perfect levels. Lenovo has attained this steady growth and it expects to maintain or improve its gross margin in China operations now and in the future.

3 0
4 years ago
Read 2 more answers
When an EC2 instance is being modified to have more RAM, is this considered Scaling Up or Scaling Out?
Nastasia [14]

If an EC2 instance is being modified to have more RAM, this is known as Scaling Up.

<h3> What is EC2 Auto Scaling?</h3>

The Amazon EC2 Auto Scaling is known to be a type of fully well handled service that has been set up to launch or hinder Amazon EC2 instances automatically.

It is often made so as to help make sure that people have the correct number of Amazon EC2 instances that is available to manage the load for their  application. To scaleup is to bring up.

Learn more about RAM from

brainly.com/question/13196228

7 0
3 years ago
____________ is the ability to stand up for your own interests and to ask for what you want. A. Discipline B. Arrogance C. Asser
devlian [24]
C. Assertiveness. Assertiveness is defined as confident and forceful behavior, so it is the only one that makes sense.
8 0
3 years ago
Read 2 more answers
What are the tools which are used by search engine ? explain them? ​
bagirrra123 [75]
Java script and python for the UK
4 0
3 years ago
Other questions:
  • Let K(x, y) denote the statement "x knows y" and D denote the domain of all people. Express the following English sentences as a
    9·1 answer
  • A spreadsheet program has many subparts. What is the smallest unit in a spreadsheet?
    9·2 answers
  • The overall purpose of CSS is to modify the way web pages look without modifying the underlying HTML code. way tables render in
    12·2 answers
  • Which are valid double statements for java? double a = 0; double b = -1.0; double c = -425; double d = 6340; double e = -1.0; do
    12·2 answers
  • Choose the reasons why Windows Server operating systems are a popular choice for a network because they _____. Select all that a
    12·1 answer
  • All of the followingshould be followed by entrepreneur for being effective
    10·1 answer
  • As a project manager, why is analysis an important aspect of the job?
    10·1 answer
  • Which of the following transferable skills are generally the most look for in the it <br> field
    10·1 answer
  • How long does it take to go 80 miles if you are going 80 mph?
    8·2 answers
  • Please help me!! (two questions)
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!