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
History timeline: who developed what elements first Windows OS and Apple OS?
Harrizon [31]

Answer:

i think bill gates

Explanation:

5 0
2 years ago
Read 2 more answers
DO NOT JOIN ANY Z O O M MEETINGS FROM THIS PERSON! IS A TRAP Please help me get them banned!!!!!
s2008m [1.1K]

Answer:

how do i help?

Explanation:

7 0
3 years ago
Read 2 more answers
What is a device that connects to the system unit and is controlled by the processor in the computer called !
Airida [17]
Most computers have three types of ports: serial, parallel, and USB. A serial port is a type of interface that connects a device to the system unit by transmitting data only one bit at a time. Serial ports usually connect devices that do not require fast data transmission rates, such as a mouse, keyboard, or modem.
4 0
3 years ago
You can access various sites on WWW by using hyperlinks or by?
wlad13 [49]
You can access various sites on WWW by using hyperlinks or by?

Answer is: A following directions on-screen
5 0
2 years ago
Read 2 more answers
When using the Common Internet File System (CIFS), which security model will require network users to have a user name and passw
hjlf

Answer:

User-level Security

Explanation:

User-level security allows the user to access resources on a network using a username and password. User-level security offers higher and greater security than share-level security, which does not require a password to access files.

User-level security allows the database user access and permission to resources.

4 0
3 years ago
Other questions:
  • katherine has work experience of seven years as a graphic designer and photographer. she wants to now redirect her career to web
    5·2 answers
  • Jennifer has been hired as a temporary employee at a local college. She is given a username and password to access certain parts
    14·2 answers
  • What are ways to enter a formula in Excel? Check all that apply. Click on the Function Library group and select a function from
    10·2 answers
  • The numbers on the bottom of a typical check represent all of the following EXCEPT
    14·1 answer
  • You view a portion of a document on the screen through a
    14·1 answer
  • How do you copy and paste a screenshot on an hd computer
    12·2 answers
  • Carol typed a memo to send to everyone in her department. To create this memo, she used a _____.
    8·2 answers
  • For what purpose is keylogging software used? a. To automatically translate input to another language as the user enters data b.
    10·1 answer
  • Image-editing software is used to_____
    7·1 answer
  • What Fortnite skin is more og?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!