General Discussions

main() – int or void?

Programmers generally use a int main() or a void main() Every function should return a type. Either a success status or a failure status. Even main is a function and should return a type. It is not advisable to use void main(). It should always be int main(). A void main() means it returns no status… Continue reading main() – int or void?

General Discussions

Machine – Input/Output

Every system is made up of atleast the following components: Input States Initial State Transitions Output Machine is also a system. Systems make transition from one state to another based on the input. The result of such transitions is the output. You feed something to machine to get something desired out of it. What you… Continue reading Machine – Input/Output

General Discussions

Void in C

Void! At times we will not know how to respond or what to assume or what exactly to do. At such time we express with the expression of ‘Nothing’. When it comes to programming language (here C), we have void. Void can be related to “Nothing” expression of ours. When we don’t have a return… Continue reading Void in C

General Discussions

Counting Word Occurrences From Huge Files

Let us say we were given to count all the occurrences of all the words from a million pages in ONE days time (24 hours). How can we do that? Here is a possible design: Pick up a dictionary which has all the words that ever exists. Get the count of number of words –… Continue reading Counting Word Occurrences From Huge Files

General Discussions

yywrap() in LEX

Function yywrap is called by lex when input is exhausted.  When the end of the file is reached the return value of yywrap() is checked. If it is non-zero, scanning terminates and if it is 0 scanning continues with next input file. More can be checked in the manual: The Flex Manual Page

General Discussions

Programming Paradigms

When you ask this question: ‘What were the principles based on which the programming language was developed?’ It kind of points out to the paradigms. Yes, It is essential to know about programming paradigms. They tell us the motivational story behind the language. They tell us how the language has perceived the real world. They tell… Continue reading Programming Paradigms

General Discussions

Learning Structures in C

You get admission to a college after clearing the entrance and you walk with several set of documents. The college admission department maintains several procedures and collects some certificates to return back at the time of graduation. Let us say there are like ten kinds of documents to be maintained for every student. Institute takes… Continue reading Learning Structures in C

General Discussions

The Clear Up

Take a walk outside. Clear all your thoughts about the doubts of ‘if you will be a good programmer or not’. Flush out any opinions you have which you had gathered from somewhere else and if you had decided that programming is not your cup of tea. Yeah! If not green tea, we shall have… Continue reading The Clear Up

General Discussions

Patterns in Software Development

Alexander writes, “Each pattern is a three part rule, which expresses a relation between a certain context, a problem and a solution”. Understanding the context with structural and dynamic properties is essential to design the patterns. A pattern is a mental concept which emerges out from our contextual understanding and experience. The understanding should be sufficient enough to formalize… Continue reading Patterns in Software Development

General Discussions

Token Provider System – Tabuada’s Way

Token provider system is the simpler version of token based system, where tokens are provided to the customers to provide the service on the first come first serve basis. The system modeled here works by providing the next token number for every new customer who walks in. The token number starts from 1 and moves up until 1000. On… Continue reading Token Provider System – Tabuada’s Way