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
During an interview, your _____ can be as influential as your skills and abilities
Leokris [45]
D. All of the above 
your appearance, attitude and image all play a very large role in an interview for a job


8 0
3 years ago
Read 2 more answers
Where are the instructions stored that the computer needs when it is switched on?
WARRIOR [948]
This is stored in the ROM (Read Only Memory)
I believe that is the answer, all i can come up with.
4 0
3 years ago
True or false?
AnnZ [28]

Answer:

True

Explanation:

Media coding is the procedure of defining the Media codes, written symbolic and technical tools that are applied to construct or come up with the meaning in various media products or forms. It includes the proper use of the camera, setting, acting, editing, special effects, sound, color, text, visual composition, graphics, typography, and mise en scene. Hence, the fact mentioned in the question is true.

7 0
3 years ago
Microsoft word's spelling checker will offer suggestions on misspelled words.<br> True)<br> False)
Rasek [7]
This is true. I hope I was helpful!
7 0
4 years ago
Read 2 more answers
Which statement regarding hard drives is incorrect?
Veseljchak [2.6K]

Answer: I think the answer is

c. solid state drives are less expensive than magnetic hard drives

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • You must have an active ____ to test external links.
    5·1 answer
  • One item you will NOT need to provide when opening up a bank account
    9·2 answers
  • Write a program that continually prompts the user for an integer input until input is entered that is less than 0. Each input th
    9·1 answer
  • If anything is changed on an already-tested module, regression testing is done to be sure that this change hasn’t introduced a n
    13·1 answer
  • While creating a sketch, what helps you identify positive and negative space?
    13·1 answer
  • How is a technical certificate like a computer-related associate degree?
    12·2 answers
  • Which type of fiber-optic connector, containing one fiber-optic strand per connector, is connected by pushing the connector into
    7·1 answer
  • What Are the Benefits of Using Leads Automation Tool?
    5·1 answer
  • Which type of error occurred in the following lines of code?
    13·1 answer
  • Which of the following tasks can you perform using a word processor?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!