questiona write a program to swap two names


QUESTION

(a) Write a program to swap two names between two variables for examples:

N1 = "Mary Anne"

N2 = "Queen Mary".

The program should make use of an appropriate Function (for e.g. SwapFunc() ) and pointers to do this.

Your program should have three blocks namely the function declaration , the main and finally the function definition.

The Function SwapFunc() should be called from main.

The program should display the names in each variable before and after calling the function SwapFunc() in main.

(b) Write a piece of code (C or C++) to declare a pointer that is pointing to an array of characters named mychar for e.g.

                                mychar may contain the following five characters z, y, x, w, v

Your program should include codes to declare the array and the pointer to the array. It should also include codes to display the address of the first element in the array using pointers.

Using a loop for the pointers the subsequent codes should display the addresses of the four remaining characters.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: questiona write a program to swap two names
Reference No:- TGS0359483

Expected delivery within 24 Hours