0% found this document useful (0 votes)
17 views53 pages

C++ Notes TO USE

The document provides an introduction to the basics of C++ programming. It demonstrates simple "Hello World" programs using cout and return. It discusses basic C++ syntax including comments, data types like int and float, variables, operators, strings, constants, and preprocessing directives like #define. The document contains multiple code examples and explanations of C++ concepts.

Uploaded by

olamilekan00100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views53 pages

C++ Notes TO USE

The document provides an introduction to the basics of C++ programming. It demonstrates simple "Hello World" programs using cout and return. It discusses basic C++ syntax including comments, data types like int and float, variables, operators, strings, constants, and preprocessing directives like #define. The document contains multiple code examples and explanations of C++ concepts.

Uploaded by

olamilekan00100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

The C++ Language Tutorial

Basics of C++

// my first program in C++ Hello World!

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World!";
return 0;
}

//

#
#include
<iostream>

main

main ()

{}
The C++ Language Tutorial

cout
Hello World

cout iostream std

//
#
cout
{}

int main ()
{
cout << " Hello World!";
return 0;
}

int main () { cout << "Hello World!"; return 0; }

;
The C++ Language Tutorial

// my second program in C++ Hello World! I'm a C++ program

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World! ";
cout << "I'm a C++ program";
return 0;
}

main

int main () { cout << " Hello World! "; cout << " I'm a C++ program "; return 0; }

int main ()
{
cout <<
"Hello World!";
cout
<< "I'm a C++ program";
return 0;
}

// line comment
/* block comment */

//
/*
*/
The C++ Language Tutorial

/* my second program in C++ Hello World! I'm a C++ program


with more comments */

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World! "; // prints Hello
World!
cout << "I'm a C++ program"; // prints I'm a
C++ program
return 0;
}

// /* */
The C++ Language Tutorial

a = 5;
b = 2;
a = a + 1;
result = a b;

a b result

asm, auto, bool, break, case, catch, char, class, const, const_cast, continue, default, delete,
do, double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto,
if, inline, int, long, mutable, namespace, new, operator, private, protected, public, register,
reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template,
this, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void,
volatile, wchar_t, while

and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
The C++ Language Tutorial

RESULT result Result

char

short int
short

int

long int long

bool

float
double
long double

wchar_t

int
char short
int long char
float double long double
The C++ Language Tutorial

int a;
float mynumber;

int a
float mynumber a
mynumber

int a, b, c;

a b c int

int a;
int b;
int c;

char short long int

signed unsigned

unsigned short int NumberOfSisters;


signed int MyAccountBalance;

signed unsigned

int MyAccountBalance;

signed

char
signed char unsigned char signed
unsigned char

short long
short short int long long int

short Year;
short int Year;

signed unsigned signed int


unsigned int

unsigned NextYear;
unsigned int NextYear;
The C++ Language Tutorial

// operating with variables 4

#include <iostream>
using namespace std;

int main ()
{
// declaring variables:
int a, b;
int result;

// process:
a = 5;
b = 2;
a = a + 1;
result = a b;

// print out the result:


cout << result;

// terminate the program:


return 0;
}

a b result int
The C++ Language Tutorial

main

main main

type identifier = initial_value ;

int a = 0;

()

type identifier (initial_value) ;

int a (0);

// initialization of variables 6

#include <iostream>
using namespace std;

int main ()
{
int a=5; // initial value = 5
int b(2); // initial value = 2
int result; // initial value
undetermined

a = a + 3;
result = a b;
cout << result;

return 0;
}

string
The C++ Language Tutorial

<string> std
using namespace

// my first string This is a string


#include <iostream>
#include <string>
using namespace std;

int main ()
{
string mystring = "This is a string";
cout << mystring;
return 0;
}

string mystring = "This is a string";


string mystring ("This is a string");

// my first string This is the initial string content


#include <iostream> This is a different string content
#include <string>
using namespace std;

int main ()
{
string mystring;
mystring = "This is the initial string content";
cout << mystring << endl;
mystring = "This is a different string content";
cout << mystring << endl;
return 0;
}
The C++ Language Tutorial

a = 5;

1776
707
273

"
1776

0
0x

75 // decimal
0113 // octal
0x4b // hexadecimal

int u l

75 // int
75u // unsigned int
75l // long
75ul // unsigned long

e
e
e
The C++ Language Tutorial

3.14159 // 3.14159
6.02e23 // 6.02 x 10^23
1.6e 19 // 1.6 x 10^ 19
3.0 // 3.0

double float long double


f l

3.14159L // long double


6.02e23f // float

e f l

'z'
'p'
"Hello world"
"How do you do?"

'

"

x
'x'

x x 'x'
'x'

\n \t
\
The C++ Language Tutorial

\n
\r
\t
\v
\b
\f
\a
\' '
\" "
\? ?
\\ \

'\n'
'\t'
"Left \t Right"
"one\ntwo\nthree"

\23 \40
x \x20 \x4A

"string expressed in \
two lines"

"this forms" "a single" "string" "of characters"

wchar_t
char

L"This is a wide character string"

bool
true false

#define
The C++ Language Tutorial

#define identifier value

#define PI 3.14159
#define NEWLINE '\n'

PI NEWLINE

// defined constants: calculate circumference 31.4159

#include <iostream>
using namespace std;

#define PI 3.14159
#define NEWLINE '\n'

int main ()
{
double r=5.0; // radius
double circle;

circle = 2 * PI * r;
cout << circle;
cout << NEWLINE;

return 0;
}

#define
PI NEWLINE
3.14159 '\n'

#define
; ;

const

const int pathwidth = 100;


const char tabulator = '\t';

pathwidth tabulator
The C++ Language Tutorial

a = 5;

a =

a = b;

a b
a

b a
b a

// assignment operator a:4 b:7

#include <iostream>
using namespace std;

int main ()
{
int a, b; // a:?, b:?
a = 10; // a:10, b:?
b = 4; // a:10, b:4
a = b; // a:4, b:4
b = 7; // a:4, b:7

cout << "a:";


cout << a;
cout << " b:";
cout << b;

return 0;
}

a 4 b 7 a
b a = b
The C++ Language Tutorial

a = 2 + (b = 5);

b = 5;
a = 2 + b;

5 b a 2
b a 7

a = b = c = 5;

5 a b c

a = 11 % 3;

a 2 2 11 3

value += increase; value = value + increase;


a = 5; a = a 5;
a /= b; a = a / b;
price *= units + 1; price = price * (units + 1);
The C++ Language Tutorial

// compound assignment operators 5

#include <iostream>
using namespace std;

int main ()
{
int a, b=3;
a = b;
a+=2; // equivalent to a=a+2
cout << a;
return 0;
}

++
+=1 =1
c++;
c+=1;
c=c+1;

++a a++ a++ ++a

a++

B=3; B=3;
A=++B; A=B++;
// A contains 4, B contains 4 // A contains 3, B contains 4

B A B A
B
The C++ Language Tutorial

(7 == 5) // evaluates to false.
(5 > 4) // evaluates to true.
(3 != 2) // evaluates to true.
(6 >= 6) // evaluates to true.
(5 < 5) // evaluates to false.

a=2 b=3 c=6

(a == 5) // evaluates to false since a is not equal to 5.


(a*b >= c) // evaluates to true since (2*3 >= 6) is true.
(b+4 > a*c) // evaluates to false since (3+4 > 2*6) is false.
((b=2) == a) // evaluates to true.

= ==
==

((b=2) == a) 2 b a
2

!(5 == 5) // evaluates to false because the expression at its right (5 == 5) is true.


!(6 <= 4) // evaluates to true because (6 <= 4) would be false.
!true // evaluates to false
!false // evaluates to true.

&& ||
&&
&& a &&
b

||
a
|| b
The C++ Language Tutorial

( (5 == 5) && (3 > 6) ) // evaluates to false ( true && false ).


( (5 == 5) || (3 > 6) ) // evaluates to true ( true || false ).

condition ? result1 : result2

condition result1 result2

7==5 ? 4 : 3 // returns 3, since 7 is not equal to 5.


7==5+2 ? 4 : 3 // returns 4, since 7 is equal to 5+2.
5>3 ? a : b // returns the value of a, since 5 is greater than 3.
a>b ? a : b // returns whichever is greater, a or b.
// conditional operator 7

#include <iostream>
using namespace std;

int main ()
{
int a,b,c;

a=2;
b=7;
c = (a>b) ? a : b;

cout << c;

return 0;
}

a 2 b 7 a>b
b
7

a = (b=3, b+2);
The C++ Language Tutorial

3 b b+2 a a
5 b 3

&
|
^
~
<<
>>

()
int i;
float f = 3.14;
i = (int) f;

3.14 3
(int)

i = int ( f );

a = sizeof (char);

1 char
sizeof

a = 5 + 7 % 2
The C++ Language Tutorial

a = 5 + (7 % 2) // with a result of 6, or
a = (5 + 7) % 2 // with a result of 0

::

() [] . > ++ dynamic_cast static_cast


reinterpret_cast const_cast typeid
++ ~ ! sizeof new delete

* &

(type)

.* >*

* / %

<< >>

< > <= >=

== !=

&

&&

||

?:

= *= /= %= += = >>= <<= &= ^= |=

( )

a = 5 + 7 % 2;
The C++ Language Tutorial

a = 5 + (7 % 2);

a = (5 + 7) % 2;
The C++ Language Tutorial

iostream

cout

cout <<

cout << "Output sentence"; // prints Output sentence on screen


cout << 120; // prints number 120 on screen
cout << x; // prints the content of x on screen

<<
Output sentence 120 x cout
"

"

cout << "Hello"; // prints Hello


cout << Hello; // prints the content of Hello variable

<<

cout << "Hello, " << "I am " << "a C++ statement";

Hello, I am a C++ statement


<<

cout << "Hello, I am " << age << " years old and my zipcode is " << zipcode;

age 24 zipcode 90064

Hello, I am 24 years old and my zipcode is 90064

cout
The C++ Language Tutorial

cout << "This is a sentence.";


cout << "This is another sentence.";

This is a sentence.This is another sentence.

cout
cout \n

cout << "First sentence.\n ";


cout << "Second sentence.\nThird sentence.";

First sentence.
Second sentence.
Third sentence.

endl

cout << "First sentence." << endl;


cout << "Second sentence." << endl;

First sentence.
Second sentence.

endl '\n'
cout
\n endl

>> cin

int age;
cin >> age;

int age cin

cin RETURN
cin RETURN

cin
The C++ Language Tutorial

// i/o example Please enter an integer value: 702


The value you entered is 702 and its double is
#include <iostream> 1404.
using namespace std;

int main ()
{
int i;
cout << "Please enter an integer value: ";
cin >> i;
cout << "The value you entered is " << i;
cout << " and its double is " << i*2 << ".\n";
return 0;
}

cin

cin

stringstream

cin >> a >> b;

cin >> a;
cin >> b;

a b

cin >>
cin >> mystring;

cin

getline
cin
The C++ Language Tutorial

// cin with strings What's your name? Juan SouliÃ‾¿½


#include <iostream> Hello Juan SouliÃ‾¿½.
#include <string> What is your favorite team? The Isotopes
using namespace std; I like The Isotopes too!

int main ()
{
string mystr;
cout << "What's your name? ";
getline (cin, mystr);
cout << "Hello " << mystr << ".\n";
cout << "What is your favorite team? ";
getline (cin, mystr);
cout << "I like " << mystr << " too!\n";
return 0;
}

getline mystr

<sstream> stringstream

string mystr ("1204");


int myint;
stringstream(mystr) >> myint;

string "1204" int stringstream


stringstream
cin
>> int

myint 1204

// stringstreams Enter price: 22.25


#include <iostream> Enter quantity: 7
#include <string> Total price: 155.75
#include <sstream>
using namespace std;

int main ()
{
string mystr;
float price=0;
int quantity=0;

cout << "Enter price: ";


getline (cin,mystr);
stringstream(mystr) >> price;
cout << "Enter quantity: ";
getline (cin,mystr);
stringstream(mystr) >> quantity;
cout << "Total price: " << price*quantity <<
endl;
return 0;
}

cin mystr
quantity
The C++ Language Tutorial
The C++ Language Tutorial

Control Structures

{ }

{ statement1; statement2; statement3; }

{}
{}

if

if (condition) statement

condition statement
statement
x is 100 x 100

if (x == 100)
cout << "x is 100";

{ }

if (x == 100)
{
cout << "x is ";
cout << x;
}

else
if

if (condition) statement1 else statement2


The C++ Language Tutorial

if (x == 100)
cout << "x is 100";
else
cout << "x is not 100";

x is 100 x 100 x is
not 100

if + else
x

if (x > 0)
cout << "x is positive";
else if (x < 0)
cout << "x is negative";
else
cout << "x is 0";

{ }

while (expression) statement

// custom countdown using while Enter the starting number > 8


8, 7, 6, 5, 4, 3, 2, 1, FIRE!
#include <iostream>
using namespace std;

int main ()
{
int n;
cout << "Enter the starting number > ";
cin >> n;

while (n>0) {
cout << n << ", ";
n;
}

cout << "FIRE!\n";


return 0;
}

while
n>0 n
n>0
The C++ Language Tutorial

n
n>0

cout << n << ", ";


n;
n n 1

n;
n n>0
n 0

do statement while (condition);

condition
statement condition
0

// number echoer Enter number (0 to end): 12345


You entered: 12345
#include <iostream> Enter number (0 to end): 160277
using namespace std; You entered: 160277
Enter number (0 to end): 0
int main () You entered: 0
{
unsigned long n;
do {
cout << "Enter number (0 to end): ";
cin >> n;
cout << "You entered: " << n << "\n";
} while (n != 0);
return 0;
}

for (initialization; condition; increase) statement;


The C++ Language Tutorial

statement condition
for initialization increase

initialization

condition statement

statement { }
increase

// countdown using a for loop 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, FIRE!


#include <iostream>
using namespace std;
int main ()
{
for (int n=10; n>0; n ) {
cout << n << ", ";
}
cout << "FIRE!\n";
return 0;
}

initialization increase
for (;n<10;)
for (;n<10;n++)

,
for initialization ,

for ( n=0, i=100 ; n!=i ; n++, i )


{
// whatever here...
}

n i

n 0 i 100 n!=i n i n
i n i
50
The C++ Language Tutorial

break

// break loop example 10, 9, 8, 7, 6, 5, 4, 3, countdown aborted!

#include <iostream>
using namespace std;

int main ()
{
int n;
for (n=10; n>0; n )
{
cout << n << ", ";
if (n==3)
{
cout << "countdown aborted!";
break;
}
}
return 0;
}

continue

// continue loop example 10, 9, 8, 7, 6, 4, 3, 2, 1, FIRE!


#include <iostream>
using namespace std;

int main ()
{
for (int n=10; n>0; n ) {
if (n==5) continue;
cout << n << ", ";
}
cout << "FIRE!\n";
return 0;
}

goto

goto
The C++ Language Tutorial

// goto loop example 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, FIRE!

#include <iostream>
using namespace std;

int main ()
{
int n=10;
loop:
cout << n << ", ";
n ;
if (n>0) goto loop;
cout << "FIRE!\n";
return 0;
}

exit cstdlib

exit

void exit (int exitcode);

exitcode
0

if
else if

switch (expression)
{
case constant1:
group of statements 1;
break;
case constant2:
group of statements 2;
break;
.
.
.
default:
default group of statements
}

expression constant1
group of statements 1 break break
switch

constant1 constant2
group of statements 2 switch

expression
case
default:
The C++ Language Tutorial

switch (x) {
if (x == 1) {
case 1:
cout << "x is 1";
cout << "x is 1";
}
break;
else if (x == 2) {
case 2:
cout << "x is 2";
cout << "x is 2";
}
break;
else {
default:
cout << "value of x unknown";
cout << "value of x unknown";
}
}

switch
break

switch break

break
switch
break switch
{ }

switch (x) {
case 1:
case 2:
case 3:
cout << "x is 1, 2 or 3";
break;
default:
cout << "x is not 1, 2 nor 3";
}

case n: n case (1..3):

if else if
The C++ Language Tutorial

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

type
name
parameters
int x

statements { }

// function example The result is 8


#include <iostream>
using namespace std;

int addition (int a, int b)


{
int r;
r=a+b;
return (r);
}

int main ()
{
int z;
z = addition (5,3);
cout << "The result is " << z;
return 0;
}

main

main z int
addition

main addition
5 3 int a int b
The C++ Language Tutorial

main main
addition 5 3 int a int
b

addition int r r=a+b r


a b a b 5 3 8

return (r);

addition
main
addition return addition
r return (r); 8

z addition (5, 3) 8
addition (5,3) 8

cout << "The result is " << z;


The C++ Language Tutorial

a b r main addition
z addition
main
The C++ Language Tutorial

// function example The first result is 5


#include <iostream> The second result is 5
using namespace std; The third result is 2
The fourth result is 6
int subtraction (int a, int b)
{
int r;
r=a b;
return (r);
}

int main ()
{
int x=5, y=3, z;
z = subtraction (7,2);
cout << "The first result is " << z << '\n';
cout << "The second result is " << subtraction (7,2) << '\n';
cout << "The third result is " << subtraction (x,y) << '\n';
z= 4 + subtraction (x,y);
cout << "The fourth result is " << z << '\n';
return 0;
}

subtraction

main subtraction

z = subtraction (7,2);
cout << "The first result is " << z;

z = 5;
cout << "The first result is " << z;

cout << "The second result is " << subtraction (7,2);

subtraction
cout

cout << "The second result is " << 5;

5 subtraction (7,2)

cout << "The third result is " << subtraction (x,y);


The C++ Language Tutorial

subtraction
subtraction x y 5
3 2

z = 4 + subtraction (x,y);

z = subtraction (x,y) + 4;

z = 4 + 2;
z = 2 + 4;

type name ( argument1, argument2 ...) statement

type

void

// void function example I'm a function!


#include <iostream>
using namespace std;

void printmessage ()
{
cout << "I'm a function!";
}

int main ()
{
printmessage ();
return 0;
}

void
printmessage

void printmessage (void)


{
cout << "I'm a function!";
}

void
The C++ Language Tutorial

printmessage

printmessage ();

printmessage;
The C++ Language Tutorial

addition

int x=5, y=3, z;


z = addition ( x , y );

x y 5 3
x y

a b 5 3
a b x y
x y

// passing parameters by reference x=2, y=6, z=14


#include <iostream>
using namespace std;

void duplicate (int& a, int& b, int& c)


{
a*=2;
b*=2;
c*=2;
}

int main ()
{
int x=1, y=3, z=7;
duplicate (x, y, z);
cout << "x=" << x << ", y=" << y << ", z=" << z;
return 0;
}

duplicate
&
The C++ Language Tutorial

a b c x y z
a x b
y c z

x y z duplicate
main

void duplicate (int& a, int& b, int& c)

void duplicate (int a, int b, int c)

&
x y z

// more than one returning value Previous=99, Next=101


#include <iostream>
using namespace std;

void prevnext (int x, int& prev, int& next)


{
prev = x 1;
next = x+1;
}

int main ()
{
int x=100, y, z;
prevnext (x, y, z);
cout << "Previous=" << y << ", Next=" << z;
return 0;
}
The C++ Language Tutorial

// default values in functions 6


#include <iostream> 5
using namespace std;

int divide (int a, int b=2)


{
int r;
r=a/b;
return (r);
}

int main ()
{
cout << divide (12);
cout << endl;
cout << divide (20,4);
return 0;
}

divide

divide (12)

divide divide
2
int b=2 int b
6 12/2

divide (20,4)

b int b=2 b
4 5 20/4
The C++ Language Tutorial

// overloaded function 10
#include <iostream> 2.5
using namespace std;

int operate (int a, int b)


{
return (a*b);
}

float operate (float a, float b)


{
return (a/b);
}

int main ()
{
int x=5,y=2;
float n=5.0,m=2.0;
cout << operate (x,y);
cout << "\n";
cout << operate (n,m);
cout << "\n";
return 0;
}

operate
int float

int
float

operate int

float
operate

inline

inline type name ( arguments ... ) { instructions ... }

inline
The C++ Language Tutorial

n! = n * (n 1) * (n 2) * (n 3) ... * 1

5! = 5 * 4 * 3 * 2 * 1 = 120

// factorial calculator Please type a number: 9


#include <iostream> 9! = 362880
using namespace std;

long factorial (long a)


{
if (a > 1)
return (a * factorial (a 1));
else
return (1);
}

int main ()
{
long number;
cout << "Please type a number: ";
cin >> number;
cout << number << "! = " << factorial (number);
return 0;
}

factorial
0

long

main
main
The C++ Language Tutorial

type name ( argument_type1, argument_type2, ...);

{ }
;

protofunction int

int protofunction (int first, int second);


int protofunction (int, int);

// declaring functions prototypes Type a number (0 to exit): 9


#include <iostream> Number is odd.
using namespace std; Type a number (0 to exit): 6
Number is even.
void odd (int a); Type a number (0 to exit): 1030
void even (int a); Number is even.
Type a number (0 to exit): 0
int main () Number is even.
{
int i;
do {
cout << "Type a number (0 to exit): ";
cin >> i;
odd (i);
} while (i!=0);
return 0;
}

void odd (int a)


{
if ((a%2)!=0) cout << "Number is odd.\n";
else even (a);
}

void even (int a)


{
if ((a%2)==0) cout << "Number is even.\n";
else odd (a);
}

odd even

void odd (int a);


void even (int a);

main

odd even even odd


The C++ Language Tutorial

odd even
even odd
The C++ Language Tutorial

Compound data types

int

int

int billy

int
0 4 0

type name [elements];

type int float name elements


[]

billy

int billy [5];

elements []

{ }

int billy [5] = { 16, 2, 77, 40, 12071 };


The C++ Language Tutorial

{ }
[ ] billy
{ }

[ ]
{ }

int billy [] = { 16, 2, 77, 40, 12071 };

billy

name[index]

billy int

75 billy

billy[2] = 75;

billy a

a = billy[2];

billy[2] int

billy billy[2] billy[0]


billy[1] billy[2] billy[4]
billy

[ ]

[
]
The C++ Language Tutorial

int billy[5]; // declaration of a new array


billy[2] = 75; // access to an element of the array.

billy[0] = a;
billy[a] = 75;
b = billy [a+2];
billy[billy[a]] = billy[2] + 5;
// arrays example 12206
#include <iostream>
using namespace std;

int billy [] = {16, 2, 77, 40, 12071};


int n, result=0;

int main ()
{
for ( n=0 ; n<5 ; n++ )
{
result += billy[n];
}
cout << result;
return 0;
}

jimmy int

int jimmy [3][5];

jimmy[1][3]
The C++ Language Tutorial

char century [100][365][24][60][60];

char

int jimmy [3][5]; // is equivalent to


int jimmy [15]; // (3 * 5 = 15)

#define WIDTH 5 #define WIDTH 5


#define HEIGHT 3 #define HEIGHT 3

int jimmy [HEIGHT][WIDTH]; int jimmy [HEIGHT * WIDTH];


int n,m; int n,m;

int main () int main ()


{ {
for (n=0;n<HEIGHT;n++) for (n=0;n<HEIGHT;n++)
for (m=0;m<WIDTH;m++) for (m=0;m<WIDTH;m++)
{ {
jimmy[n][m]=(n+1)*(m+1); jimmy[n*WIDTH+m]=(n+1)*(m+1);
} }
return 0; return 0;
} }
The C++ Language Tutorial

#define

#define HEIGHT 3

#define HEIGHT 4

[]

void procedure (int arg[])

int arg

int myarray [40];

procedure (myarray);

// arrays as parameters 5 10 15
#include <iostream> 2 4 6 8 10
using namespace std;

void printarray (int arg[], int length) {


for (int n=0; n<length; n++)
cout << arg[n] << " ";
cout << "\n";
}

int main ()
{
int firstarray[] = {5, 10, 15};
int secondarray[] = {2, 4, 6, 8, 10};
printarray (firstarray,3);
printarray (secondarray,5);
return 0;
}

int arg[] int


The C++ Language Tutorial

for

base_type[][depth][depth]

void procedure (int myarray[][3][4])

[]

You might also like