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
Tasya [4]
3 years ago
9

Write a program to test the difference between %d and %i conversion

Computers and Technology
1 answer:
Gelneren [198K]3 years ago
7 0
Void test(char *s)
{
  int i, d;
  sscanf(s, "%i", &i);
  printf("%s converts to %i using %%i\n", s, i);
  sscanf(s, "%d", &d);
  printf("%s converts to %d using %%d\n", s, d);
}

int main()
{
  test("123");
  test("0x123");
  return 0;
}

outputs:
123 converts to 123 using %i
123 converts to 123 using %d
0x123 converts to 291 using %i
0x123 converts to 0 using %d

As you can see, %i is capable of parsing hexadecimal, whereas %d is not. For printf they're the same.
You might be interested in
What is the result of the following code?<br><br> x=7//2+10%2**4<br><br> print(x)
spin [16.1K]

Answer:

3

Explanation:

We can split the expression into two sections

First Section:

7 // 2 = 3. Using the floor division we only utilize the integer part.

Second Section:

10 % 2**4 = 0**4 = 0

Bringing back the full version expression we have

3 + 0 = 3

7 0
2 years ago
Which device allows you to convert sounds into digital format to be used on the computer​
Anton [14]
The correct anwser is ADC
8 0
3 years ago
Convert (65.125)10 to octal.
grigory [225]

Answer:

101.1

Explanation:

Keep in mind that octal has 8 numbers

Step 1: Split your number in 2 parts (integer part and decimal part):

  • integer part 65
  • decimal part 0.125

Step 2: Convert the decimal part. For this step you need to multiply your decimal part and 8 (8 correspond the octal base) and get the integer part until you need it:

      0.125 * 8 =  1

So your decimal part correspond to number 1 in octal = (1)8

Step 3: Convert integer part: for this step you need to divide your integer part by 8 until you can and get the remainder

      65 / 8 = 8 remainder 1

        8 / 8 = 1 remainder 0

         1 / 8 = 0 remainder 1

Step 4: join the remainders from bottom to top and get the integer part

            101

Step 5: join the integer part and the decimal part to get the octal convertion

              101.1

5 0
3 years ago
. List 5 types of exploits from cybercrime and provide brief definition. (2.5 Marks)
Flura [38]

In cyber security, an exploit is a way attackers take advantage of certain vulnerabilities and gain malicious access to systems. There are very many types of exploits that exist in the cyber security world. However, I will mention those ones most commonly used.

DoS attacks – The denial of service attacks is very common. Hackers will gain access to servers and send so many packet requests at the same time. The servers become overwhelmed due to too much memory allocation and the huge amount of traffic ends up crashing the servers.

Unauthorized access – When an attacker has an illegal access to host machines

<u>Application Exploitation</u>

Code injection – This exploit can be used to maliciously inject invalid code into an application program or software and as a result change how the program behaves.

Cross-site scripting – Enable hackers inject malicious scripts on a website of a client. Once they have gained access, they will escalate their privileges and have more access to the site.

Clickjacking – A type of attack that tricks unknown victims into clicking links of a web page they believe are legitimate and end up revealing confidential information of themselves.

6 0
3 years ago
What is client server relationship is the basic form of what
stepan [7]

computer network is the answer                          

8 0
3 years ago
Other questions:
  • ACCOUNTING
    13·2 answers
  • You would like to search for information about storms but not tornadoes. What type of search strategy may be useful?
    10·2 answers
  • Which statement is used to create a file object that will append data to an existing file? BufferedWriter salesdata =
    7·2 answers
  • Who is hurt by piracy
    10·1 answer
  • List the components of a typical operating system and summarize the role of each in a single phrase.
    6·1 answer
  • What can hack or code can I use to get a shadow or frost dragon in adopt me
    6·2 answers
  • HURRY please!!!!
    13·1 answer
  • What Pre-Built PC should I get? I don't have a lot of money so I'm looking for cheap options.
    8·1 answer
  • Helppppppppppppppppppppppppppppppppp
    13·2 answers
  • Why is it essential for every person living in the 21st century to have a computer​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!