Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

Functions Tutorial

Posted: Oct/07/2009   By: pankaj   Points:15   Category: C/C++/VC++  - C++    Views:110   Vote Up (0)   Vote Down (0)    
Using functions we can structure our programs in a more modular way, accessing all the potential that structured programming can offer to us in C++.

A function is a group of statements that is executed when it is called from some point of the program. The following is its format:


type name ( parameter1, parameter2, ...) { statements }

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

Classes Tutorial

  
A class is an expanded concept of a data structure: instead of holding only data, it can hold both data and functions.

An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable.

Classes are generally declared using the keyword class, with the following format:


class class_name { access_specifier_1: member1; access_specifier_2: member2; ... } object_names;

Data Structures Tutorial

  
We have already learned how groups of sequential data can be used in C++. But this is somewhat restrictive, since in many occasions what we want to store are not mere sequences of elements all of the same data type, but sets of different elements with different data types.

Data structures

A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Data structures are declared in C++ using the following syntax:

struct structure_name {
member_type1 member_name1;
member_type2 member_name2;
member_type3 member_name3;
.
.
} object_names;

Pointers Tutorial

  
The memory of your computer can be imagined as a succession of memory cells, each one of the minimal size that computers manage (one byte). These single-byte memory cells are numbered in a consecutive way, so as, within any block of memory, every cell has the same number as the previous one plus one.

This way, each cell can be easily located in the memory because it has a unique address and all the memory cells follow a successive pattern. For example, if we are looking for cell 1776 we know that it is going to be right between cells 1775 and 1777, exactly one thousand cells after 776 and exactly one thousand cells before cell 2776.

C++ Tutorial

  
A class in C++ is an encapsulation of data members and functions that manipulate the data. The class can also have some other important members which are architecturally important.
This C++ Tutorial discusses the components of a C++ class. More C++ tutorials will follow.

C++ Static Functions

  
Static member functions have a class scope and they do not have access to the 'this' pointer of the class. When a member is declared as static, a static member of class, it has only one data for the entire class even though there are many objects created for the class. The main usage of static function is when the programmer wants to have a function which is accessible even when the class is not instantiated.

C++ Friend Functions

  
In this C++ tutorials, you will learn about friend functions, need for friend function, how to define and use friend function and few important points regarding friend function, explained with example.

C++ Virtual Functions

  
Virtual, as the name implies, is something that exists in effect but not in reality. The concept of virtual function is the same as a function, but it does not really exist although it appears in needed places in a program. The object-oriented programming language C++ implements the concept of virtual function as a simple member function, like all member functions of the class.

Static Functions - An Introduction

  
The static member functions have a class scope and they do not have access to the 'this' pointer of the class. When a member is declared as static that is a static member of class have only one such data for the entire class even though there are many objects created for the class. The main usage of static function is when the programmer wants to have a function which is accessible even when the class is not instantiated.

C++ Inline Functions

  
In this C++ tutorial, you will learn about Inline function, what is inline function, reason for the need of inline function, what happens when an inline function is written, general format of inline function explained with example.
 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge