Jump to content

help with homework

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
rajan

rajan

    Newbie

  • Members
  • Pip
  • 1 posts
Explain output
1) #include<stdio.h>
extern int i;
main()
{
printf("%d",i);
}
2) #include<stdio.h>
extern int i=100;
main()
{
printf("%d",i);
}

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Are you trying to figure out what they do, or something else?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
XJamesX

XJamesX

    Newbie

  • Members
  • PipPip
  • 17 posts
LOL ummm run it through a compiler and see.
while(1) { if(if_girl_is_pretty(girl)) ask_her_out();
else drink_another_beer(); }

#4
FrozenSnake

FrozenSnake

    Learning Programmer

  • Members
  • PipPipPip
  • 44 posts
My interpretation of this BAD topic is that you have to do the following:

What is the output in the first snippet and why?
What is the output in the second snippet and why?

To find that out you have to do a dreadful thing! You have to READ! your course book.
It's the most dreaded thing in your life apparently. This is a SIMPLE homework if you cant find this out yourself you should quit the course. Because you wont make it if you cannot read your course book or listen to your teacher when he say:

"If you use a variable without giving it a value this will happen: [---]" explanation is in the bold part here.
So now you open your book and read the first and second chapter in the book and you will understand why the output is this way.

Oh and read this: http://forum.codecal...r-homework.html

Good luck!

Edited by FrozenSnake, 24 March 2010 - 01:17 PM.
change valuble to variable :P


#5
cdg10620

cdg10620

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 389 posts
Analyze this code snippet.


While( !User.hasAnswer )
{
     User.askQuestion();

     if( User.postCode && User.putForthEffort )
     {
          CodeCallMembers.Help();
          User.hasAnswer = true;
     }
     else
     {
          CodeCallMembers.Laugh();
     }
}


-CDG10620
Software Developer

#6
lintwurm

lintwurm

    Learning Programmer

  • Members
  • PipPipPip
  • 77 posts
@CDG10620: every time I see your snippet I have to lol...
^_^

#7
fread

fread

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 787 posts
That thing actually looks like real code....lol
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:

#8
cdg10620

cdg10620

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 389 posts

lintwurm said:

@CDG10620: every time I see your snippet I have to lol...
^_^

That snippet is in a lot of places now. :P lol. I plan on posting it every time I see someone post this crap. :)
-CDG10620
Software Developer