Rules of function, C/C++ Programming

Rules of function:

  • Inline function created without prototype it reduces the memory and it is used only for small function. Inline function cannot have recursion, static variable ,goto and switch .
  • Default argument should be specified in the prototype.
  • Function defined below the main program should have a prototype or declaration before calling the function. Where as function declared above require not have prototype.
  • When a function with default argument is known without the argument then that argument gets the default value.
  • Constant argument can also have default value. Default value cannot be modified only inside the function; but any value can be passed to constant argument.
  • Functions without argument and with only one argument as default argument will guide to uncertainty (unclear) for the compiler; therefore the programmer should avoid such type of function declaration.

Class  is  a  fresh  concept  introduced  in  C++.    It  is  the  core  of  objected  oriented programming.                          

Class  is  advanced  extension  of  structure  in  C  language.   The  members  in structure are array and primary data type.  The members can be accessed globally or it can be said they are public members.  Structure serve only limited.  It is primarily used to group a collection of data  and  define  it as a structure. Other than  that  there  is special advantage  of defining  a structure. To overcome these boundaries C++ has introduced a new type of concept called Class.

A class is defined as structure with using key word class.  A class can have primary data types  and  functions  as  its  members. These  members  can be hidden  by making  as  private members.   When the members are not defined public as or private the members take default property as private members.   To make the members public, the word public should be defined inside the class.

Posted Date: 9/20/2012 7:50:38 AM | Location : United States

Related Discussions:- Rules of function, Assignment Help, Ask Question on Rules of function, Get Answer, Expert's Help, Rules of function Discussions

Write discussion on Rules of function
Your posts are moderated
Related Questions

Operation on String - C ++ Program: Write a program to define operations on string in c++. class String {    char *char_ptr;   // pointer to string contents    int le

how to declare multi dimensional array

The voltage at the terminals of a battery is 52V when no load is linked and 48.8V when a load taking 80A is connected. Find the internal resistance of the battery. What wou

write a atm program in c with inbuilt functions for 1782?

Explain redirection in c++

You are to write a C++ program which will compute the gross pay, Social Security Tax, Income Tax and net pay for an employee. The program needs to prompt for and read the employ

Program to show the ascii value of characters: int main() {                 int one_char;                 cout                 one_char = getch();

#questio#A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concate

Most first graders know that nine hundred and ninety nine plus one is one thousand, but C++ doesn't! Sure, a computer can easily compute 999 + 1 and get 1000. But reading and writi