The last ever C programming mistake

Discussion in 'The Lounge' started by goldfish, Jan 22, 2005.

  1. goldfish

    goldfish Lt. Sushi.DC

    if (authorisation = "yes") {
    launchmissiles();
    }

    ;)
     
  2. goldfish

    goldfish Lt. Sushi.DC

    Anyone find the problem yet? :p
     
  3. scorcer

    scorcer ajMro keGe

    the answer is "epswiche clams" :p :p :p


    no??, is it the spelling of authoriZation??
     
  4. NeoNemesis

    NeoNemesis Moutharrhea

    Im gonna go with, theres no 'else' so wouldn't it do the launchmissles() no matter what?
     
  5. goldfish

    goldfish Lt. Sushi.DC

    Nope ;)

    spelling means nothing, and I'm english so i spell it authorisation
     
  6. mcadam

    mcadam Major Amnesia

    spaces between authorisation and = sign??
     
  7. goldfish

    goldfish Lt. Sushi.DC

    nope, but closer ;)
     
  8. NeoNemesis

    NeoNemesis Moutharrhea

    no 'then' so the launchmissles() would be separate from the 'if'.


    not sure seeing as how i don't know c
     
  9. jarcher

    jarcher I can't handle a title

    I don't know a thing about programing, or spelling for that matter
    but i would say that
    authorisation= launchmissles
     
  10. MrPewty

    MrPewty MajorGeek

    The Brackets? I seem to remember those brackets hiding text in Pascal, but that was 15 years ago, and I haven't done any programming since. Never did C.
     
  11. NeoNemesis

    NeoNemesis Moutharrhea

    im gonna go with you, now that i think about it. WHen I did c++, I never used parenthesis. Heck, neither in basic too.
     
  12. MrPewty

    MrPewty MajorGeek

    That would be the curly brackets around launchmissles();



    Hmmm. Now that I think back, maybe it was * * that hid text.

    Maybe the ";" is in the wrong place, not being on the end of the line(after the last bracket).

    Maybe I'm rambling...
     
  13. Phantom

    Phantom Brigadier Britches

    if (authorisation = "yes") {(launchmissiles)};


    Makes more sense to me. Then again, I'm not a programmer. :rolleyes:
     
  14. goldfish

    goldfish Lt. Sushi.DC

    nope, launchmissiles() is a perfectly normal bit of code.

    You're not gunna get it, unless Kodo comes along all of a sudden :p

    SPOILER:














    its the authorisaton="yes" part. when you are comparing two values, you use ==, !=, >, < .... the = charachter signifies the operation of setting a variable. That condition says that if (set authorisation to yes) works correctly, then... So, prodvided the variable can be set, it will always return true, regardless of what authorisation was to start with.
     
  15. Maxwell

    Maxwell Folgers

  16. evilevets

    evilevets Sergeant Major

    () is going to launch missiles regardless?


    Steve
     
  17. goldfish

    goldfish Lt. Sushi.DC

    No, (authorisation = yes) makes authorisation equal to yes, rather than checking if it equals yes or not. To check it, it needs to be if (authorisation == yes).
     
  18. NeoNemesis

    NeoNemesis Moutharrhea

    ahhh, in C++ I used to spend hours trying to figure out what I was going wrong, turned out to be just that.
     
  19. NeoNemesis

    NeoNemesis Moutharrhea

    I'm learning a bit of PHP and this seems like it would catch quite a few people. So whats wrong with this one?

    $blah = "Hello";
    print ('$blah and Welcome');

    Goldfish, stay outta this one!
     
  20. animatorStrike

    animatorStrike <a href="http://www.acrodata.com/fun/waaa.jpg">Rid

    You don't use print in PHP. You use echo...or at least I think so. And, you don't need to put the variable in the (). This is how I think it should be:

    $blah = "Hello";
    echo $blah (' and Welcome');
     
  21. NeoNemesis

    NeoNemesis Moutharrhea


MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds