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 8754091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:33:12+00:00 2026-06-13T13:33:12+00:00

There was a question in an exam I took. The question was: What will

  • 0

There was a question in an exam I took. The question was:

What will be the output of the following code:

#include<stdio.h>
#include<conio.h>

void main()
{
 int a=5, b=6, c=7;
 printf("%d%d%d");
}

My answer : It will give a warning as printf has not been provided with the required arguments.
And if you will run it, you will get garbage values.

The teacher gave me zero. According to him, the answer is that the values will be printed in reverse order i.e the output will be “765”.

The catch is he is using the Turbo C++ compiler and I generally use GCC. Can I have some comments and explanation to get my marks back? Or is my answer really wrong?

  • 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-06-13T13:33:14+00:00Added an answer on June 13, 2026 at 1:33 pm

    This is an undefined behavior, so absolutely anything can happen.

    The local variables might be actually printed, because on some systems Xprintf functions family might pop their arguments off the stack (stdarg.h facilities could be used for implementation of such functions). Your variables a,b,c might happen to be at the memory location from which va_arg macro will take extract the arguments. These are the details of library implementation / execution environment and are not part of the standard, so they can vary across different target platforms.

    Here is a quote from c99 standard describing fprintf function:

    7.19.6.1 The fprintf function

    2/ The fprintf function writes output to the stream pointed to by
    stream, under control of the string pointed to by format that
    specifies how subsequent arguments are converted for output. If there
    are insufficient arguments for the format, the behavior is undefined.

    If the format is exhausted while arguments remain, the excess
    arguments are evaluated (as always) but are otherwise ignored. The
    fprintf function returns when the end of the format string is
    encountered.

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

Sidebar

Related Questions

I have faced the following interview question. Consider this function declaration: void quiz(int i)
I have this code (question from exam) and there are many errors in the
I just wrote this exam, in which there was question: Consider a array of
Marvin Minsky asked me the following question during my oral exam: As an ant
I had an exam today and there was a question which I don't really
I'm preparing for my UNIX exam and there is a question about memory location
I was given the following question on an exam and it seems as though
I am studying for my midterm exam. There is going to be a question
Newbie question: There are three types of Asp.Net controls : HTML server controls, Web
Here is my question - There are two classes Order and PaymentType . An

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.