Here I have listed some selected problems or questions related to pointers
in C++. Solve them to increase your programming skills.
Problem #1:
// Problem or Question in C++
// --------------------------
// Problem related to pointers
// for increasing programming
// skills
#include<iostream.h>
void main()
{
char ch[]="I_Like_C++";
cout<<*&*&ch;
}
Problem #2:
// Problem or Question in C++
// --------------------------
// Problem related to pointers
// for increasing programming
// skills
#include<iostream.h>
void main()
{
int i,*p,**q,***r;
i=10;
p=&i;
q=&p;
r=&q;
cout<<i<<*p<<**q<<***r;
}
Problem #3:
// problem related to pointers
#include<iostream.h>
void main()
{
char ch[]="Programming Skills";
char *s=ch;
cout<<s+++3;
}
Problem #4:
// Problem related to pointers
#include<iostream.h>
void main()
{
int ar[2][2][2]={1,2,3,4,5,6,7,8};
cout<<***ar;
cout<<ar[1][1][1];
}
ANSWERS:
#1: I_Like_C++
#2: 10101010
#3: gramming Skills
#4: 18
Since this article has become a bit too long, I have broken it into one more
part.
Read Increase
your Programming Skills II
Hope this helps!
Good-Bye!
Related Articles:
-
Increase your Programming Skills III
-
Simple
Problems in C++ Part IV
-
Simple
Problems in C++ Part III
-
Simple
Problems in C++ Part II
-
0 comments:
Post a Comment