Ad

Saturday, July 21, 2007

Increase your Programming Skills I

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:

No comments:

Post a Comment

You are free to comment anything, although you can comment as 'Anonymous' it is strongly recommended that you supply your name. Thank You.

Please don't use abusive language.