function prototype/declaration – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2016-02D #JAVA#4227    siteicon   siteicon  

Problem Statement - function prototype/declaration

Write a function prototype of the following:
A function PosChar which takes a string argument and a character argument and returns an integer value.

Solution

TC++ #4227

The prototype or function declaration for given question can be written as follows

int PosChar(String s,char c)
{

<.. body instructions>
}

 

Notes

  • If we go by technical precision, Java actually does not required a concept of prototype to validate data types of a functions as is required in C++. One can read this question answer trail in quora.
    https://www.quora.com/Why-does-C++-have-function-prototypes-but-Java-doesnt
  • It will be more appropriate if questions in board examinations are more precisely framed and they are not on the basis on some old text books which are not updated and provide weak foundation of concepts.


Share

sunmitra| Created: 31-Mar-2018 | Updated: 16-Apr-2019|ICSE2016









Back