Proxy > Gmail Facebook Yahoo!

Increase your Programming Skills Part-2



Solve the problems listed here to gain programming skills.
Problem #5:
  // Problem or Question in C++
  // --------------------------
  // Problem related to pointers
  // for increasing programming
  // skills

  #include<iostream.h>

  void main()
  {
   char ch1[]="Programming";
   char ch2[]="Skills";

   char *s1=ch1;
   char *s2=ch2;

   while(*s1++=*s2++);
     cout<<ch1;
  }
Problem #6:
  // Problem or Question in C++
  // --------------------------
  // Problem related to pointers
  // for increasing programming
  // skills

  #include<iostream.h>

  void main()
  {
   int i, *j;

   i=1;
   j=&i;

   cout<<i**j*i+*j;
  }
Problem #7:
  // Problem related to pointers

  #include<iostream.h>

  void main()
  {
   int ar[]={1,2,3,4,5};
   char *p;

   p=(char *)ar;

   cout<<*((int *)p+3);
  }
Problem #8:
  // Problem related to pointers

  #include<iostream.h>

  void change(int *,int);

  void main()
  {
   int ar[]={1,2,3,4,5};

   change(ar,5);

   for(int i=0;i<5;i++)
     cout<<*(ar+i);
  }

  void change(int *p,int n)
  {
   for(int i=0;i<n;i++)
     *(p+i)=*(p+i)+3;
  }
ANSWERS:
#5: Skills
#6: 2
#7: 4
#8: 45678


Responses

0 Respones to "Increase your Programming Skills Part-2"


Send mail to your Friends.  

Expert Feed

 
Return to top of page Copyright © 2011 | My Code Logic Designed by Suneel Kumar