what is the output for program below

int a = 5;
int A = 8;
A = 9;
a = 7;
printf ("%d%d", aA);

Recommended Answers

All 5 Replies

You would get a syntax error from your compiler.

if you change your printf to:

printf("%d%d", a, A);

i believe it will will print out 79

Not to mention that this is easily tested without bothering other people. I mean really, how hard is it to fire up your compiler and run a simple test:

#include <stdio.h>

int main ( void )
{
  int a = 5;
  int A = 8;
  A = 9;
  a = 7;
  printf ("%d%d", aA);
  return 0;
}

Then you would have been able to answer both questions ("Why a syntax error?" and "What does this output when the error is fixed?") all by yourself.

Looks more like a troll than a real post.

haha yeah compiling and running that program is basically the same thing asking the computer what that program will output

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.