home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.sys.tandy      Life is dandy cuz you're gettin a Tandy!      5,684 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,892 of 5,684   
   Mark McDougall to tommytune123@gmail.com   
   Re: Model 4 C compiler problem   
   29 Jun 08 23:37:40   
   
   e5e34087   
   From: msmcdoug@no.spam.iinet   
      
   tommytune123@gmail.com wrote:   
      
   > main (argc, argv) {   
   > int argc;   
   > char *argv[];   
   > int i=5;   
      
   You have actually declared variables argc & argv which are local to the main   
   function and are created on the stack at runtime. They aren't initialised,   
   and hence you get garbage when you print them out.   
      
   Since I'm assuming you instead intended to use the old ANSI C style of   
   parameter declaration, your argc, argv declarations must be done *before*   
   the opening curly brace. I'm not 100% sure of the syntax regarding commas   
   and semi-colons, since I haven't used this style for about 20 years, but I'm   
   sure a few trial compilations and you'll get it right.   
      
   Regards,   
      
   --   
   |              Mark McDougall                | "Electrical Engineers do it   
   |     |   with less resistance!"   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca