Local-static and global variable


Q1. Write down a function which reverses a C-String (an array of characters). Use for loop which swaps the first and last characters, then the second and next-to-last characters and so forth. The string must be passed to the function as the argument.

Q2. Distinguish between the local, static and global variable in terms of scope and life-time.

Q3. Distinguish between the member function and static member function in C++

Q4. Write down six differences between the structure and class in C++.

Q5. Write down a C++ program which creates a class time with two integers and in one float as hour, minute and seconds correspondingly. There must be two constructors one for initializing these values to zero and the other for initializing them to fixed values. In case seconds are not given, it must be automatically initialized to the zero. A member function must display time in 02:45:67.05 formats. There must as well be member function which adds two time objects.

Q6. Write down the semantics (meaning) of the given declarations:

a) char **pt
b) int (*array) [10]
c) int *array [10]
d) void (*funct)()
e) char (*(*X())[]) ()
f) char (*(*X[5])()) [10]

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Local-static and global variable
Reference No:- TGS012051

Expected delivery within 24 Hours