What is subprogramming?

    In the earlier  days of the programming programmers use to write very lengthy line by line code to get a event a small task done from the computer by using language COBOL  basic perform etc 

soon the programming industries came that this is not a proper programming model because a lot of code complex hence the invention C language "Dennis M Rithie" introduced  the concept of sub programming (POP procedure Oriented programming ) where the subprograms were called by the main programs 

* Sub programs are divided into 2 categories 

1. Procedures 

2. Functions 

     Both procedure and function is a code block created for reusability the only differences between a procedure and function is 

     procedure only perform a actions only but doesn't return any value back to main method whereas  function after performing the actions compulsory return the value back to the main hence the last statement of function is always  a keyword called "return"  

Whether it is a procedure or a function in C language everything is called as a function 

      In OOPs  languages Java,C# etc whether it is procedure or a function they are always called as "method".

*Procedure , function or method are divided into 4 categories 

1. method with no arguments(parameter) no return value

2. method with parameter no return value 

3. method with parameter with return value 

4. method with no argument (parameter) but with return value

Comments

Blogs