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 symbol do we use to denote a character?
pychu [463]

Answer:

'Single Character'

Explanation:

A Character, commonly abbreviated as "char", is a computer symbol, letter, or number. A keyboard is an input device that inputs a character when a key is pressed.

5 0
2 years ago
Which of the following correctly describes the syntax of an If statement?
Ber [7]

if(Expression to be tested) {

code to execute

} else if(Expression to be tested) {

code to execute

}


you can have as many else ifs as you want. But that's what it looks like.

8 0
3 years ago
Which term does not refer to a variant of the full-size secure digital (sd) memory card?
dsp73

Micro SD term does not refer to a variant of the full-size secure digital (sd) memory card.

<h3>What is Secure Digital a memory card?</h3>

A Secure Digital (SD) card is a tiny flash memory card developed for high-capacity memory and different portable devices, such as car navigation systems, cellular phones, e-books, PDAs, smartphones, digital cameras, music players, digital video camcorders, and individual computers.

<h3>What is the best device for storing digital photos?</h3>

Hard drives are good for storing photos because they are cheap, they provide fast admission to data, and it's very easy to copy a whole hard drive to another hard drive  especially if you have USB 3.0 or Thunderbolt associations

To learn more about Micro SD, refer

brainly.com/question/24723558

#SPJ4

4 0
2 years ago
Which is the order of steps for attaching an item to a contact?
aivan3 [116]
We need to know what item and then we can answer ur question
5 0
3 years ago
Read 2 more answers
How do you make an app for help
timama [110]
If you have a iPhone say "108" to Siri it will auto make an app
5 0
3 years ago
Read 2 more answers
Other questions:
  • EXPLAINING A URL
    15·1 answer
  • Which of the following typically have the highest auto insurance premiums?
    14·1 answer
  • When you're working with a word processing document and you press the del key, what happens?
    5·1 answer
  • You have dinner with your family and tell them that you have taken bcis. your mother tells you that she is proud of you and that
    9·1 answer
  • 2) Search the Web for two or more sites that discuss the ongoing responsibilities of the security manager. What other components
    15·1 answer
  • Zoom meeting ID:987 6858 5587 Password:196133
    10·2 answers
  • What Is entered into the system as input?
    13·1 answer
  • A financially stable person is able to:
    8·1 answer
  • Which term refers to the science that specifies the design and arrangement of items you use so you interact with the items effic
    15·1 answer
  • 1. Keisha is in her first semester of college and is taking 10 credit hours: ACA 122, CIS 110, PSY 150, and developmental math.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!