Increase your Programming Skills II

This is the continuation of the last article… Increase
your Programming Skills


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


Good-Bye!


Related Articles:


Check out this stream