Write a program to swap two names between two variables, Basic Computer Science

Assignment Help:

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.


Related Discussions:- Write a program to swap two names between two variables

Management information system, Is IT a strategic weapon or a survival tool?...

Is IT a strategic weapon or a survival tool? Discuss.

Enterprise collaboration system, what is the goals of enterprise collaborat...

what is the goals of enterprise collaboration system?

Data type, Data Type:  Data Type: Anything that is processed by a comp...

Data Type:  Data Type: Anything that is processed by a computer is called data. There are different types of data that can be given to the computer for processing. A  data typ

Comparison instructions , They are used to evaluate operators, and they hav...

They are used to evaluate operators, and they have an effect on the content of the flags. CMP CMPS (CMPSB) (CMPSW) CMP INSTRUCTION Idea: To measure up to the operators. Syntax: CMP

Hardware, Hardware Hardware includes the cable and a Hub/Switch that...

Hardware Hardware includes the cable and a Hub/Switch that will connect the participating computers together. Printers or any other peripherals connected to one computer can

Definition of procedure, A procedure is a compilation of instructions to wh...

A procedure is a compilation of instructions to which we can express the flow of our program, and once the execution of these instructions is over power is given back to the next l

#algorithm, #to determine whether given year is leap year or not

#to determine whether given year is leap year or not

Register array, #queA register is a memory location surrounded by the CPU i...

#queA register is a memory location surrounded by the CPU itself, designed to be rapidly accessed for purposes of fast data retrieval. Processors normally hold a register array, wh

Prelude to programming concepts and design 5th edition, Input a list of pos...

Input a list of positive numbers, terminated by 0, into an array numbers []. Then display the array and the largest and smallest number in it.

Data autonomous transmission, DATA AUTONOMOUS TRANSMISSION: This could ...

DATA AUTONOMOUS TRANSMISSION: This could be the possible replacement for the ARINC 429 standard and will be annotated the standard - ARINC 629. In the DATAC system, the contro

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd