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

Conversion between Objects of Different Classes As the compiler does not know anything about the user-defined type, the conversion instructions are to be specified in a functio

Draw a flowchart for a program that allows the user to enter 20 names along with their ages and their Social Security Numbers in three parallel arrays. Programs shou

Write a program in C that you will name "divide.exe", to divide one 32-bit twos-complement binary number by another, giving the quotient and the remainder, using the subtract-shift

Tracing of Abstract array: inline int isZero( const Object& o ) {     return o == NOOBJECT; }   int AbstractArray::isEqual( const Object& obj ) const {

Structures A structure is a derived data type. It is a combination of logically related data items. Unlike arrays, which are a collection of such as data types, structures can

what is the syntax to get a coloured output.

Project Description: We want to generate premium numbers for one of our application. What we need is: A program that generate 2, 3, 4, 5, 6, 7, 8 digits premium numbers

I''m having trouble with my C code to red from a Hash table. Not sure what it is I''m doing wrong and stumped. I need to get it figured out by tomorrow at 4:00 p.m. Eastern time. C

Objective: Construct a C program that controls the UART, and is capable of displaying strings. Echo characters received on the UART to the LCD screen Outcome: A mess