|
-
October 26th, 2010, 02:14 AM
#1
Few Qs about Cconventions (variable naming and variable/argument ordering etc)
1. Should I name an unchanging variable received as input from the user when starting a program with all CAPS like a constant?
2. When declaring variables at the start of a function, is there any ordering convention I can follow? For example, types of greater size like size_t, pointers etc should be entered before char types, or arrays of any type should be first or... I never know where I should put a new variable, and the top of my main function or example looks messy. Maybe I need to group some into structures or something.
3. Following from question 2, how about ordering of arguments?
4. How do I determine whether to use an int or a size_t? I have a couple variables specifying maximum sizes which will probably be fine in int, but they are specifying sizes so should I use a size_t anyway. Sould I just use size_t's for all numbers?
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|