










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Dr. Mehandi Nandakumar delivered this lecture at Baddi University of Emerging Sciences and Technologies for Introduction to Computer Programming course. Its main points are: Void, Pointer, Pointers, Multidimensional, Arrays, String, Dynamic, Allocation, Memory, Leak
Typology: Slides
1 / 18
This page cannot be seen from the preview
Don't miss anything!











-^ Two dimensional string pointers e.g. C++ dictionary^ char
*keyword[][2]
=
{ "for",
"for(initialization;
condition;
increment)",
"if",
"if(condition)
...^
else^
...",
"switch",
"switch(value)
{^ case-list
}",
"while",
"while(condition)
...",
//^ add
the^
rest^
of^ the
C++^
keywords
here
"",^ ""
//^
terminate
the^
list^
with^
nulls
}; int main(){ char
str[80];int i;cout <<^ "Enter
keyword:
";
cin^ >>
str; for(i=0;
*keyword[i][0];
i++)
if(!strcmp(keyword[i][0],
str))
cout^
<<^ keyword[i][1]; return
0; }
^ char
movies[5][20]
{“Godfather”,“Maula
Jatt”, “A^ Fish
Called
Wanda”,
“Blade
Runner”, “Spiderman”}; ^ char
*movies[5]
{“Godfather”,“Maula
Jatt”, “A^ Fish
Called
Wanda”,
“Blade
Runner”, “Spiderman”};
const int RSIZE = 4;const int CSIZE = 6;int * iarray[RSIZE];for(int k=0; k<RSIZE; k++){ iarray[k] = new int [CSIZE];if (iarray[k] == NULL){
cerr << “Memory Allocation Error…\n”;cerr << “Exiting …\n”;exit(-1); } }
iarray 0 1 2 3
int a = 20;int *ip = &a;int **ipp = &ip;int ***ippp = &ipp;cout << a << endl;cout << ip << *ip << endl;cout << ipp << *ipp << **ipp << endl;cout << ippp << *ippp << **ippp << ***ippp << endl;