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
kykrilka [37]
2 years ago
10

Whats the flow in this code, and whats the risk that its creating and what can i do to fix it? (c language)

Computers and Technology
1 answer:
Advocard [28]2 years ago
6 0

Answer:

The risk is a buffer overflow.

Explanation:

Whatever the user passes as a command line argument, will be copied into the buffer. If the user passes more than 499 characters, the end of the buffer will be overwritten.

To solve it, compare the string length of argv[1] to 500 before copying, or even better, start using the new strcpy_s( ) function.

You might be interested in
write a program in C# that reads a set of integers and then finds and prints the sum of the even and odd integers?​
trapecia [35]

Answer:

The program in C# is as follows:

using System;

class Prog {

 static void Main() {

   int n;

   Console.WriteLine("Number of integers: ");

   n = Convert.ToInt32(Console.ReadLine());

   int evensum = 0, oddsum = 0; int inpt;

   for(int i = 0;i<n;i++){

       inpt = Convert.ToInt32(Console.ReadLine());

       if(inpt%2==0){            evensum+=inpt;        }

       else{            oddsum+=inpt;        }

   }

    Console.WriteLine(evensum);

    Console.WriteLine(oddsum);

 }

}

Explanation:

This declares n, the number of integer inputs

   int n;

This prompts for n

   Console.WriteLine("Number of integers: ");

This gets input for n

   n = Convert.ToInt32(Console.ReadLine());

This declares and initializes the even and odd sum.

   int evensum = 0, oddsum = 0; int inpt;

This iterates through n

   for(int i = 0;i<n;i++){

This gets each input

       inpt = Convert.ToInt32(Console.ReadLine());

Check for even numbers and add,if even

<em>        if(inpt%2==0){            evensum+=inpt;        }</em>

Otherwise, add input as odd

<em>        else{            oddsum+=inpt;        }</em>

   }

Print even sum

    Console.WriteLine(evensum);

Print odd sum

    Console.WriteLine(oddsum);

 }

5 0
2 years ago
______ is an example of unauthorized access to your computer or accounts.
pychu [463]
Well, it wouldn't be Adware because that just has to do with ads and stuff...
It wouldn't be cookies either because they just store things to make life easier.

It would be between Phishing and Hacking. I don't think it's Phishing because that's tricking someone into giving them your account information.

I think it would be hacking.

I hope that this helps. If it does, please rate it as Brainliest :D


4 0
3 years ago
Which of the following aspects of a computer is responsible for making sense of input? processing output memory storage
SVEN [57.7K]

Answer:

Processing

Explanation:

The processor of a computer takes inputs runs them through the loaded programs and returns outputs usually to the screen or speakers of the computer.

8 0
3 years ago
Read 2 more answers
What is the name of the symbol that is used to classify and categorize information?​
igomit [66]

Answer:

A Hashtag

Explanation:

3 0
3 years ago
Read 2 more answers
To ____ a public member function of a base class in the derived class, the corresponding function in the derived class must have
Norma-Jean [14]

Answer:

None of the mentioned options

Explanation:

  • If we define a method in a derived class with same declaration type as that of base class then it is said to be overriding a function which behaves differently which will depend on the object which is calling the method.
  • Option a,b and c are not any kind of methods we implement using coding.
  • Option d is done when number or data types of parameters are different than the declaration of the base type.

8 0
3 years ago
Other questions:
  • What is UNIX? A program for writing documents Graphical interface Internet browser Operating system
    8·2 answers
  • As with country citizenship, with digital citizenship comes _____.
    14·2 answers
  • Your computer has a single hard disk w/ a single volume used by the C:\ drive. You have previously upgraded the disk to a dynami
    6·1 answer
  • Your task is to write and test a function which takes one argument (a year) and returns True if the year is a leap year, or Fals
    5·1 answer
  • Given n ropes of different lengths, we need to connect these ropes into one rope. We can connect only 2 ropes at a time. The cos
    9·1 answer
  • What are listed in the vertical columns across the top of the Event Editor?
    5·2 answers
  • Retype and run, note incorrect behavior. Then fix errors in the code, which should print num_stars asterisks.
    9·1 answer
  • Pleaseeeeeeeee I will give a brainliest
    7·1 answer
  • .... . .-.. .-.. --- .-.-.-<br><br><br> TRANSLATE THAT.
    10·1 answer
  • Two types of storage memory​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!