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

Computer generations, Computer Generations: From the early 1940's to t...

Computer Generations: From the early 1940's to the present, computer scientists have been able to identify clear-cut stages in the development of computer technology. With eac

Stack, How to write an algorithm to reverse the order of elements on a stac...

How to write an algorithm to reverse the order of elements on a stack s using two additional stacks

Explain the tcp/ip reference model with diagram, Question 1 Define the fol...

Question 1 Define the following terms                                   1) Analog Signals and Digital Signals 2) Composite signals Question 2 Define the following terms

C++ programming, write a program of 2 sum and 2 product number in C++ progr...

write a program of 2 sum and 2 product number in C++ programming language

Database management software, Database Management Software: For storage of...

Database Management Software: For storage of large amounts of varied data, and rapid retrieval and interpretations of data, the database is the ideal tool. It is most useful for s

Theory of computation, If L is a regular language show that L U {a} is regu...

If L is a regular language show that L U {a} is regular

Encoder, What is an encoder? Draw the logic circuit of Decimal to BCD encod...

What is an encoder? Draw the logic circuit of Decimal to BCD encoder and explain its working.?

Constant bit rate atm theory, For the connections that request a static amo...

For the connections that request a static amount of bandwidth that is continuously available during the connection lifetime. Is intended to support real time applications requiring

Virtual memory, What is virtual memory? How address mapping is done in cach...

What is virtual memory? How address mapping is done in cache memory? Elaborate your answer with examples.

Software, Software Computer cannot be used without a software in...

Software Computer cannot be used without a software in it. It is the software which gives instructions to the hardware of the computer so as to work all devices in tande

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