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

  • Home
  • SEARCH
  • 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 1003969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:03:35+00:00 2026-05-16T08:03:35+00:00

this program hangs after taking first argument:- #include <stdio.h> #include <conio.h> void ellip(char*,…); int

  • 0

this program hangs after taking first argument:-

#include <stdio.h>
#include <conio.h>
void ellip(char*,...);
int main(int argc,char* argv[]){
    printf("a");
    ellip("first argument",99,"second arg","thirdarg");
    _getch();
return 0;
}
void ellip(char* m,...)
{   char com='c';
    for(;;)
        {   
            auto g=0;
            while(com=='c')
            {

                printf("%d\nMatched Continue:-",g++);
                scanf("%c",&com);


            }
        }
}

while the same program with a subtle modification(Addition of space)

scanf("%c ",&com);

Works Fine!

Is this some sort of bug in vc or a problem in my computer?

  • 1 1 Answer
  • 3 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-16T08:03:36+00:00Added an answer on May 16, 2026 at 8:03 am

    When the new line is read from stdin and placed into com, then com is now '\n' and the for(;;) loop will loop forever while the while(com=='c') will never be entered.

    scanf("%c ",&com); fixes the problem because the space character will cause scanf to skip over all white space.

    See the MSDN article. FIrst bullet point explains what the space charcter is doing.

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

Sidebar

Related Questions

This program builds a dictionary out of a list based on what two index
This program returns: package main import ( flag fmt ) func main() { num_agents
This program runs just fine, but for some reason when I ask for an
this program is for class to display the database in Listview.i want to add
This program I use has it's own variables to set when you run it,
This program stores pairs in a map, counting the number of times a word
This program reads emails (really just a .txt file structured like an email) and
This program I'm doing is about a social network, which means there are users
This program is meant to generate a dynamic array, however it gives an access
This program below moves the last (junior) and the penultimate bytes variable i type

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.