“Hello world” is the first lesson in any language. We always always try to improve our coding knowledge. But for a professional development we should follow good and generic standards for writing a code. With my experience in C,I understood the fact,that writing a code is not a great thing. But writing a error free code in small span of time and which can be referred or enhanced by other developers without any confusion makes a perfect code. As I strongly believe, Today’s best solutions becomes tomorrows Best Practices. We need to learn form our mistake and others experience to become perfect.
With this perception I would like to share my experience to enrich your Coding experience.
Here is some standard for coding C that you can follow to get the best result, and can save your life from Reviewer’s comments.
If you have below goals in mind:
- Code should be robust and error free.
- Code should be easy to use and understand.
- Code should be easy to maintain.
This is for you.
Naming Conventions
General:
- Clear and informative names are one of the best tools for creating easily understandable code. The name of any identifier should succinctly describe the purpose of that identifier.
- Avoid abstract names (in a global context) that are likely to be reused by other parts of the system.
File Names:
- Header(.h) files should have the same name as the .c for header files dedicated to the .c.
- File names should be made up of a prefix, underscore, base name, period and suffix. File names should be consistent with the area of the application being modified. File names should represent the content or role of the file.
- Header file names should have the extension “.h”.
- C Implementation (source) file names should have the extension “.c”
Function Names:
- Function names should reflect what they do or what they return.
- Do NOT re-use names of functions from the standards libraries (such as printf or strlen).
- Function names should normally be formed from two parts: an action (verb) and an object (noun) of the action. Exceptions are query functions where the second part is not a noun, but the name should form a “question”.
eg. GetSystemTime() SetStringLength()
Variable Names:
- Variable names should be descriptive of the variable’s functions.
- Constant names should be in all CAPS, with multiple words separated by an underscore, e.g. MAX_PAGERS.
- Macros, with or without parameters, should also be in all CAPS.
- Enumeration constants and global typedef names should be in all CAPS with individual words separated by underscores, e.g. DATA_VALID.
















Awsome content, what template do you use in your blog ?
Thanks for the appreciation. We have created this template from the default wordpress kubrick template to suite our website.
What tamplate do you use in your blog? Very interesting articles
Excellent article, bookmarked for future referrence
Thanks for the comment. Hope you have also gone through part-2. Keep following ,as we will be posting more blogs. Please provide your valuable comments or suggestions.
Other variant is possible also
I never comment on blogs, but your awsome content have forced me to to leave some positive feedback
Nice work, your awsome content have forced me to to leave some positive feedback
I just found your blog via Google by luck and must say it’s a very nice site. Will visit this blog again soon! My site is http://www.wordpressrobot.com/amazing-wordpress-plugin
Always bear in mind that your own resolution to succeed is more important than any one thing.
What blog script do you use on your site ?
Etwas OT, aber was ich mich immer schon gefragt habe, warum T-Shirt Druck so teuer ist? Ich meine, die ganzen T-Shirt Drucker wollen knapp 20€ für ein normales T Shirt mit meinem eigenen Motiv haben. Ich suche jetzt aktuell für meine Band einen Anbieter, der mir Kleinserien druckt (so 10-20 stk). Kennt da jemand einen preiswerten Anbieter?
Who reads papers when they have such a informative website to read. I was really asking myself on this matters so I went to Yahoo, typed my question and voila, here I am. Such a wonderful surprise to get to your site. Thank you for your time and for this great post. Thank you cute search engine for bringing me here.
Goodbye!
Actually, this seems a pretty decent blog, and since I’ve contemplated entering the 21st Century, you’re a good source of advice.
I am a great lover! Appreciate your sharing offering this
Thanks for your valuable comments… Hope you will find part 2 of this as good. please keep post your valueable comments.
Incredible report,I anticipate some more post from you.
hey,this is Caryn Vanduynhoven,just observed your Blog on google and i must say this blog is great.may I quote some of the writing found in the web site to my local buddies?i am not sure and what you think?anyhow,Thank you!
Howdy there,just observed your web-site when i google something and wonder what webhosting do you use for your wordpress,the speed is more faster than my blog, i really need it.will back to check it out,thank you!
Hello,just identified your web-site when i google something and wonder what web hosting do you use for your blog,the speed is more faster than my website, i really need it.will back to check it out,i appreciate it!
hey,this is Nanette Dalla,just identified your Post on google and i must say this blog is great.may I quote some of the Post found in your website to my local buddies?i’m not sure and what you think?in either case,Many thanks!
I’m not so convinced but nice share.