   Why this doesn't work
  I was coding parts of my name game tonite... and came across this problem:   void Onetimethings(){srand(time(NULL));int pa = 0, vo = 250;// Player amount, Vowel cost}it gives me this error - C:\Documents and Settings\Matthew\My Documents\programming\ntfediting.c(8) : error C2143: syntax error : missing '';'' before ''type''Error executing cl.exe.ntfediting.obj - 1 error(s), 0 warning(s)But if I do this:   void Onetimethings(){int pa = 0, vo = 250;// Player amount, Vowel costsrand(time(NULL));}Its compliers with out errors   (friend) WHAT!!!!..... Are you crazy???(me) Yes I am.    
  C allows variable declarations only at the beginning ofa code block. Read an introduction to the C language wherethis is explained in more detailed manner.;  You''re coding in C, which had the stipulation that within every block (a block being { ... }), there must be no variable declarations AFTER a statement.  In this case you were declaring pa and vo after calling srand(), which is not allowed in C.  C++ compilers let you do this.Just to let you know, you''re creating variables in that function that fall out of scope as soon as Onetimethings() returns.  So only inside of Onetimethings() may you access pa and vo.  If you make them global and just set their values in Onetimethings() you should be fine.-Auron ;  also, a small note, your camel notation is wrong.Onetimethings()should be:oneTimeThings()assuming it is camel notation you''re trying to use. capitalising the first world and not the rest wouldn''t really make sense. hard to see where each word starts. but that''s just a small note. ;  Thanks everybody for pointing that out... and whats this camel notation... never heard of that before???   (friend) WHAT!!!!..... Are you crazy???    (me) Yes I am.   [edited by - librab103 on August 1, 2003 12:28:51 AM];  If I''m not wrong, it''s a type of notation in which multi-word identifiers have all words after the first capitalized.  So Onetimethings() becomes oneTimeThings() and Thisismyvariableoffun becomes thisIsMyVariableOfFun, but one word identifiers remain all lowercase (ie: position or delta). -Auron ;quote:Original post by Auron  If I''m not wrong, it''s a type of notation in which multi-word identifiers have all words after the first capitalized.  So Onetimethings() becomes oneTimeThings() and Thisismyvariableoffun becomes thisIsMyVariableOfFun, but one word identifiers remain all lowercase (ie: position or delta). -Auron   spot on. it''s a pretty handy notation. plus you use all upper case letters for every word for a class defitinon.and for the love of all that is good please never use hungarian notation (if u haven''t heard of it, good).oh, and camel notation makes you code run 10% faster. and hungarian 10% slower. plus camel notation is smiled upon by the Greek God of Programming and earns you fly buys. so it''s great.;quote:Original post by MelvinElvin  spot on. it''s a pretty handy notation. plus you use all upper case letters for every word for a class defitinon.and for the love of all that is good please never use hungarian notation (if u haven''t heard of it, good).oh, and camel notation makes you code run 10% faster. and hungarian 10% slower. plus camel notation is smiled upon by the Greek God of Programming and earns you fly buys. so it''s great./quote]Would you capitalise single letter words? So would you do:thisIsASpecialVariable?Or...thisIsaSpecialVariable?   ;quote:Original post by MelvinElvin  spot on. it''s a pretty handy notation. plus you use all upper case letters for every word for a class defitinon.and for the love of all that is good please never use hungarian notation (if u haven''t heard of it, good).oh, and camel notation makes you code run 10% faster. and hungarian 10% slower. plus camel notation is smiled upon by the Greek God of Programming and earns you fly buys. so it''s great.What do you mean it makes your code run faster? No it doesnt! its just formatting, making your code more comprehendable, thats all its about as far as i know. ;quote:Original post by Tiffany_Smith  What do you mean it makes your code run faster? No it doesnt! its just formatting, making your code more comprehendable, thats all its about as far as i know.   Correct.When compiled, the symbolic names are reduced to an array of integers (vtable). 