loading...

CS410 Visual Programming Assignment No. 01 Semester Fall 2012 Solution

CS410 Visual Programming Assignment No. 01 Semester Fall 2012 Solution

Assignment Helping Topic:

Pointer De-referencing

Tasks:

1 – Declare an array of pointer integer type having five elements.

2 – Declare and initialize integer array of five elements named as a. For example:

int a = {1,2,3,4,5};

3 – Declare and initialize an array of character type, named as b. For example:

char b = {‘a’,’b’,’c’,’d’,’e’};

4 – You have to assign values of integer array to integer pointer array.

5 – Then you have to assign values of character array to pointer array of integer type.

6 – Print values of array a, so that the output is as below (for the set of values as provided in step 2 and 3)

 

7 – You also required to provide the explanation of the output in 3 -4 lines at max.

Deadline:

Your assignment must be uploaded on or before November 06, 2012.

Solution:

 

// This program demonstrate the functions of arrays and pointer realtionship

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{

int *x[5];
int a []= {1,2,3,4,5};
char b[5] = {‘a’,’b’,’c’,’d’,’e’};
int i;
*x=&a[0];
for (i=0; i<5; i++)
{
printf(“A[%d] : %dn”, (*x)[i], a[i]);
}

for(i=0; i<5; i++)
{

//*x=b;
}

system(“PAUSE”);
return EXIT_SUCCESS;
}

DOWNLOAD SOLUTION HERE
loading...
  • Horyapoli

    how to download dev++ from lms

    • عادل بھیا

      zaroori nai ap lms se hi kro, ap apne subject k downloads main jao wahan Dev++ ka download link hoga.  ager nai to CS201 walay course k downlaods main check kro, kafi saray CS k subjects k sath wo downloads main dia hota hai