Hello all,
I am solving some of the exercises in a new book of C++
I am having trouble in declaring
A Reference to a array of 10 Integers
Its on the 19TH and 30th line.
I have the total code over here.
//Declarations for all the types.
#include <iostream>
int main()
{
/*Ignore all the following variables*/
int b;
char a;
char c;
char* d=&c;
char characterstrings[]="Hello, World\n";
/* Donot Ignore after this
All the above are dummy variables required for Initialisation.
The "//" Comments are the questions
*/
char* sk; //A pointer to a character
int array[10]; //An Array of 10 integers array[0]....array[9]
int& ref=array[0];/*Doubt*/ //A Reference to an array of 10 Integers.
char* ptr_charstrings=characterstrings;//A pointer to an array of character strings.
char** ptr_to_ptr; //Pointer to a Pointer to char.
const int ic=5; //Constant Integer.
const int* ic_ptr; //A pointer to a constant integer.
int const* constptr=&b; //A constant pointer to an integer.
/*------------------------------------------------------------------------------------------------*/
/*------------------------------INITIALISATIONS---------------------------------------------------*/
char* sk2=&a;
int array2[10]={1,2,3,4,5,6,7,8,9,10};
//int& ref2 (No Idea on what to do.)
//Already Initialised Characterstrings
char** ptr_to_ptr2=&d;
//Constant integer already Initialised.
const int* ic_ptr2=&b;
//Constant Pointer already Intialisized.
}
I am not pretty sure that all of the above are correct so please help me correct them up.