Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 619687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:40:56+00:00 2026-05-13T18:40:56+00:00

wondering all about C, can you demystify this I am using turbo C I

  • 0

wondering all about C, can you demystify this

I am using turbo C

I have this code

scanf(“%d , %d”,&a,&b);
printf(“%d,%d”,a,b);
scanf(”%c”,&c);
printf(“%d,%d”,a,b);

then scanf for doesnt scan value of c

output is : 1,2

if I use this

scanf(“%d , %d”,&a,&b);
printf(“%d,%d”,a,b);
scanf(”%c ”,&c);//note a blank after %c
printf(“%d,%d”,a,b);

then it scan value of c.

output is 1,2 1,2

same code

scanf(“%d , %d”,&a,&b);
printf(“%d,%d”,a,b);
scanf(”%1s”,&c);
printf(“%d,%d”,a,b);

in this segment value of a will be displayed but value of b will be set 0

output is 1,2 1,0

can you explain the answers of both the questions.

didnt got the answers yet help me…….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:40:56+00:00Added an answer on May 13, 2026 at 6:40 pm

    How do you know that no character is being scanned for c in the first case? I assume it is because you provide a unexhibited print statement and don’t see anything.

    Read the man page careful about the behavior of the %c specifier:

    c
    Matches a sequence of width count characters (default 1); the next
    pointer must be a pointer to char, and there must be enough room
    for all the characters (no terminating NUL is added). The usual
    skip of leading white space is suppressed.
    To skip white space
    first, use an explicit space in the format.

    [emphasis added]

    If you input has a form like 1, 2 a the first scan eats the 1 , 2 and leaves the a, at which point the second scan eats the space. Not sure how the second example would work in this case.

    Anon. is on the money about the third case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi all I was wondering how I can go about searching for files in
I don't know very much about sockets at all. What I am wondering is
Hullo all, Wondering if there are any Java hackers who can clue me in
I am wondering why I can't see all page events in visual studio 2008,
Was just wondering how you all go about centering a subview in the viewcontrollers
I'm wondering how I can go about accessing page controls from a separate class
I was wondering if this code snippet is considered legal: $arr = array(123,456,789,123,456,789); foreach($arr
I'm wondering if I can tell git to resolve conflicts by appending their code
I'm wondering if someone can help me with this. I am currently trying to
I'm aware of what WYMEditor is all about and that using Paragraphs for spacing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.