Archive for the ‘Operating Systems’ Category
Kubuntu Operating System
Last week we talked a little bit about Linux and I introduced you to a program called Slax which served the purpose of being a perfect introduction for those new to this Operating System. The big downside to Slax was that it wasn’t really designed for installing on to a hard drive and so didn’t really lend itself to being used as a long term alternative to Windows.
This week we’ll take a look at a Linux Operating System which is designed to be installed either as a direct replacement or installed permanently alongside the Microsoft offering going by the name of Kubuntu. Because Kubuntu is based on the KDE graphical interface those of you that tried out Slax last week will find this variant of Linux extremely easy to get to grips with. Where it differs is that Kubuntu isn’t designed from the ground up to be easily portable and as such it comes bundled with more software and is also easily installable on your hard drive.
By heading to www.kubuntu.org you can download the 700mb package free of charge.
This software can then be put on to a bootable CD so that your new Operating System can be tried out before you choose to continue with the installation. The problem here is that Kubuntu runs pretty slowly off of a CD so don’t let this put you off putting it on to your hard disk.
The first time I used Kubuntu it set up and installed pretty much all my hardware (with the exception of my printer) automatically without any intervention and I was up and running on the Internet immediately. This is pretty impressive when you compare it to the half hour installation routine that is involved when setting up Windows for the first time.
Included with the default installation is a range of tools for your graphics, multimedia and Internet applications as well as the extremely capable OpenOffice package which is used as a direct, free replacement for Microsoft Office.
I have reviewed OpenOffice for Windows in the past and found it to be quite a capable package consisting of a Presentation, Spreadsheet, Database and Calculator utilities as well as a Word Processor. Of course if you need to use an application that isn’t included as part of the default installation this can be easily done by using the inbuilt add/remove programs manager. A bonus of using a Linux based Operating System is that pretty much all the software that you’ll ever obtain will be legally free of charge.
As mentioned at the beginning of this article the User Interface is based on KDE which is fairly similar to that of Windows and so most users shouldn’t have a problem finding their way around the basic functions of the Operating System. The system is relatively easy to use and when installed on the hard disk the performance is impressive especially when compared with Windows on lower specification hardware.
I’m certainly not suggesting that Linux is the ideal solution for everybody as to do so would be hypocritical as I personally still use Windows in my day to day life however Kubuntu is certainly worth looking in to especially if you have a lower hardware specification or resent having to pay every couple of years for the latest version of Windows.
Pretty much any variant of Linux is completely free of charge so you can download and experiment to find out which one suits you the best however the two versions Slax and Kubuntu I have reviewed are certainly good places to start.
Error Loading Operating System
Error loading operating system is an annoying error message that appears on Windows platform when you reboot your PC. Before trying to start fixing this problem, you need to know the source of error. Mostly errors such as error loading operating system appear when there is problem inside registry of your computer.
Common Causes:
When trying to install Windows for first time in your PC.
You are upgrading current version of Windows.
Corrupted operating system.
Windows Internal Setting is Incorrect.
When error loading operating system appears on your screen then you need to perform following steps:
Reinstall your OS:
It is possible that when you tried installing Windows operating system on your PC then problem encountered during installation process. In this situation you should try performing the install again by rebooting your system. If problem persists then move to next step.
Scan system for Viruses:
Error loading operating may also occur if you were hit by a virus. There are lots of viruses which install file that is causing compatibility issues or if virus has corrupted some important file in the registry. To fix this problem, scan your system for possible errors and keep your virus definitions up to date. Restart your computer to see whether problem is out. If it exists then you should move to next important step.
Fix Windows Registry:
Windows registry is database where operating system stores all sensitive information. Corruption in this part leads to data loss. If operating system does not load on your system then it would be wise to run that in safe mode, perform following steps:
1. Reboot your computer.
2. Run Windows in Safe Mode.
3. Open your web browser.
4. Search for reliable registry cleaner and PC optimizer tool.
5. Download, scan and repair Windows registry.
6. Start Windows normally.
There are two methods to fix Windows registry. One is manual modification and another is to use recommended registry cleaner. Manual modification of registry is better for technicians as its difficult to deal with complex database.
Running a registry cleaner on your computer gives several benefits, it scans registry of computer to find out any possible corruption. It also repairs by removing unwanted files.
To prevent form Error loading operating system, take a look at this globally known RegInOut. To fix internal problems and to speed up computer download Intel Software Partner on your system.
Isolated Operators in C++
C++ Operators – Part 8
Introduction
This is part 8 of my series, C++ Operators. All the operators we have seen so far exist in groups of at least two operators per group. The assignment operators have the simple assignment operator, the += operator, the -= operator, etc. in one group. By isolated operators, I am referring to operators that do not belong to any group and just exists on their own. In this part of the series, we look at isolated operators in C++.
Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at forchatrans@yahoo.com. That is, contact me for the slightest problem you have about what you are reading.
The Conditional Operator
An operator known as the conditional operator is ?:. It is the ? and : signs separated. The syntax of this operator is:
condition ? return this value if true : return this other value if false
So you have an if-condition. If it is evaluated to true, the value after the ? sign is returned. If the condition is evaluated to false the value after the : sign is returned. The following code illustrates this:
#include <iostream>
using namespace std;
int main()
{
int a = 7;
int b = 8;
int c = b>a ? 50 : 40;
cout << c;
return 0;
}
a and b are integers. The condition is if b is greater than a. If it is, 50 is returned, else 40 is return. The return value is assigned to the integer, c, which can be declared at that position. In this case either of the return values must be integers. Both return values should be of the same type, which does not only have to be an int. The type can be a float for example, or something else. The object the return value is assigned to must be of the same type as both of the returned values.
The ?: operator is a right-to-left operator.
The Comma Operator
Two expressions can be separated by a comma (,). In this case the left expression is evaluated and then the right expression is evaluated next. The result of the left expression is discarded even though it has been evaluated. The return value of the comma operator is the result and type of the right expression. The operation of the comma operator is from left to right. The following code segment illustrates the use of the comma operator,
#include <iostream>
using namespace std;
int main()
{
int a;
int b;
b = (a=3, a+2);
cout << b;
return 0;
}
a and b are integers declared without any value assigned to any of them. Then you have the statement where the operands for the comma operator are in brackets. The left operand of the comma operator is “a=3″, which is evaluated but the result is not returned. When it is evaluated, the value of a becomes 3; no result is returned but in memory, the value of a is 3. The right operand of the comma operator is “a+2″, which is evaluated next. In memory, the value of a is already 3, so 2 is added by the right operand to the value, making the value of a in memory, 5. This value is return. The statement assigns it to b. So the value of b becomes 5.
The Function Call Operator
The function call operator is (). You must have used this operator. It is used when you are calling a function. If the called function needs arguments, the arguments go inside this operator. () is a left-to-right operator.
The [] Operator
The [] operator is used when creating arrays. You must have seen this before. [] is a left-to-right operator.
The Scope Operator
While writing a program, it is possible to have more than one identifier with the same name for different reasons. Such a situation should be avoided. The way to avoid this is to put your identifiers in what is called namespace. If in two different namespaces you have one identifier in each of the namespaces with the same name, there will be no problem, because to use any of the identifiers you have to precede each with the namespace name. Between the namespace name and the identifier, you type the scope operator (::). The following code illustrates this:
#include <iostream>
using namespace std;
namespace ns
{
int identA;
int identB;
}
int main()
{
ns::identA = 6;
cout << ns::identA;
return 0;
}
A namespace begins with the reserved word, namespace. This is followed by the name you want for the namespace. Then you have curly braces. Inside the curly braces you can have declarations of the identifiers. To use any of these identifiers as in the main function above, you begin with name of the namespace, followed by the scope operator and then the identifier name.
The scope operator is a left-to-right operator.
Well, we have seen most of the C++ operators in this series. Let us stop here and continue in the next part of the series, where we shall look at what is called operator precedence and a few other things.
Chrys
To arrive at any of the parts of this series, just type the corresponding title below and my name, Chrys, in the Search Box of this page and click Search (use menu if available):
Assignment Operators in C++
Arithmetic Operators in C++
Equality and Relational Operators in C++
Logical Operators in C++
Unary Operators in C++
Type Casting Operators in C++
Pointer to Member Operators in C++
Isolated Operators in C++
Operator Precedence in C++
Type Casting Operators in C++
C++ Operators – Part 6
Introduction
This is part 6 of my series, C++ Operators. Casting means changing the object type of an operand to another; you need operators to do that. In this part of the series, we look at C++ type casting operators. We first look at casting with fundamental types. After that we look at casting with instantiated objects. Instantiated objects are objects created from classes.
Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at forchatrans@yahoo.com. That is, contact me for the slightest problem you have about what you are reading.
Implicit Conversion
You can convert one type of fundamental object to another type implicitly. You do this using the simple assignment operator. The following code illustrates this:
#include <iostream>
using namespace std;
int main()
{
float hisFlt = 23.67;
int myInt = hisFlt;
cout << myInt;
return 0;
}
The first statement in main initializes a float object (hisFlt). The value of this float object has a decimal part. The second statement in main assigns the float object to an int. This is implicit casting, because no casting operator has been used. The myInt object now holds an int whose value should be the same as the value of hisFlt. You still have two objects, each with its value and after the conversion, the values in the two objects should be the same.
Well, with implicit conversion (type casting) there may be loss of precision. The value of myInt is actually, 23 without the decimal part; an integer can never have a decimal part.
You can cast fundamental objects using implicit conversion (simple assignment), but you may lose precision depending on the nature of the operands involved on either side of the assignment operator.
Implicit conversion has the disadvantage that you are still using the simple assignment operator, and in this case the meaning of the simple assignment operator is modified. To avoid this disadvantage you can use explicit conversion (see below).
Explicit Conversion
Explicit conversion does the same thing that implicit conversion does but this time you use parentheses to indicate that the casting is explicit. With explicit conversion you still use the simple assignment operator, but its meaning is not modified; it does the simple assignment. After the assignment operator, the second operand is preceded by the new object type envisaged. On the right side of the assignment operator you can put the new object type in parentheses or you put the second operand in parentheses. The following code shows the case where the new object type is in parentheses:
#include <iostream>
using namespace std;
int main()
{
float hisFlt = 23.67;
int myInt = (int) hisFlt;
cout << myInt;
return 0;
}
Note the second statement in main. The following code shows the case where the second operand is in parentheses:
#include <iostream>
using namespace std;
int main()
{
float hisFlt = 23.67;
int myInt = int (hisFlt);
cout << myInt;
return 0;
}
Note the second statement in main. With explicit conversion, you still have loss of precision depending on the nature of the operands on either side of the assignment operator. The output of the above two code samples is 23 without the decimal part. The explicit conversion works just like implicit conversion, but this time parentheses are used to indicate that casting is taking place, and the meaning of the assignment operator is not modified. Always remember that both implicit and explicit conversions can have loss of precision in the same way.
When you want to cast objects of fundamental types use implicit or explicit conversion casting. What about instantiated objects? For this, use the casting operators given below. You need basic knowledge in C++ Object Oriented programming to understand the rest of the article. If you do not have that knowledge, then read the series I wrote titled, Object Oriented Programming in C++. To reach the series, type the title and my name Chrys in the Search Box of this page and click Search.
dynamic-cast
The dynamic-cast operator is an operator that is used to cast a derived object to a base object. This operator works with pointers (and references) to both objects. The following code shows how a derived object is cast into a base object.
#include <iostream>
using namespace std;
class TheBase
{
public:
void bMthd()
{
cout<<”I am of the base”;
}
};
class TheDerived: public TheBase
{
public:
void dMthd()
{
cout<<”I am of the derived”;
}
};
TheDerived dObj;
TheBase *bObjPtr;
int main()
{
bObjPtr = dynamic_cast<TheBase*>(&dObj);
return 0;
}
In the code, you have the base class described. Then you have the derived class described. After that you have a declaration statement that instantiates an object for the derived class. Next you have another declaration statement that instantiates an object for the base class but with a pointer. At this point, you have a derived class object identified by an ordinary identifier (without the * or & operator). You also have a base class object pointed to by a pointer.
In the main function the dynamic_cast operator is used. It casts the derived instantiated object to the base instantiated object. The base object is now a converted form of the derived object and no longer what is was.
The dynamic_cast operator uses the pair of angle brackets and parentheses. In the parentheses you have the address of the source object (derived object). In the angle brackets you have the pointer type specifier of the target object (base object). The return value received at the left side of the simple assignment operator, is the pointer (address) to the converted object. In the dynamic_cast statement above, bObjPtr would now be pointing to a copy of the derived object converted, and no longer whatever it was pointing to. At the end there are two objects, as they were at the beginning. The difference now is that bObjPtr is no longer pointing to whatever it was pointing to before. It is now pointing to a copy of the derived object converted.
In simple terms the syntax for the dynamic_cast operator is:
baseObjPtr = dynamic_cast<baseClassName*>(&IDOfDerivedObj);
You can now use the converted derived object (base object pointer) as you would use the base object. The following code illustrates this:
#include <iostream>
using namespace std;
class TheBase
{
public:
void bMthd()
{
cout<<”I am of the base”;
}
};
class TheDerived: public TheBase
{
public:
void dMthd()
{
cout<<”I am of the derived”;
}
};
TheDerived dObj;
TheBase *bObjPtr;
int main()
{
bObjPtr = dynamic_cast<TheBase*>(&dObj);
bObjPtr->bMthd();
return 0;
}
Question: With the conversion of fundamental types there can be loss of precision. Is there similarly, a loss of member with the dynamic_cast operator that converts derived object to base object? Yes there is.
Each of the above two classes has its own method. The base class method is bMthd() but the derived class method is dMthd(). The following statement will not work:
bObjPtr->dMthd();
This confirms the loss of members from derived to base class as the conversion takes place.
static_cast
The static_cast operator can be used to convert a base class object to a derived class object. It works using pointers (and references) to the base and derived objects. Know that the static_cast operator is not as reliable as the dynamic-cast operator. Its syntax is the same as with dynamic-cast, but this time, the positions of the pointers (references) are inter-changed, since you are converting from base to derived and not derived to base. The following code illustrates the use of the static_cast operator:
#include <iostream>
using namespace std;
class TheBase
{
public:
void bMthd()
{
cout<<”I am of the base”;
}
};
class TheDerived: public TheBase
{
public:
void dMthd()
{
cout<<”I am of the derived”;
}
};
TheBase bObj;
TheDerived *dObjPtr;
int main()
{
dObjPtr = static_cast<TheDerived*>(&bObj);
dObjPtr->dMthd();
return 0;
}
In simple terms, the syntax of the static_cast operator to convert a base object to a derived object is,
derivedObjPtr = static_cast<derivedClassName*>(&IDOfBaseObj);
Some good news here: with the static_cast operator and in the conversion from base object to derived object, the base members are not lost. So the following statement will work after conversion:
dObjPtr->bMthd();
However, be warned: the static_cast operator is not as reliable as the dynamic_cast operator.
reinterpret_cast
The dynamic-cast and static_cast operators convert related objects. However, the reinterpret_cast operator converts any instantiated object to another. It also works using pointers (and references) to the source and target objects. In simple terms its syntax is,
targetObjPtr = dynamic_cast<targetClassName*>(&sourceObj);
Here, conversion does not really take place; a simple binary copy of the source object is made to the target object. Such a conversion is very unreliable and is not really useful.
const_cast
The aim of the const_cast operator is to remove the constant feature of an object during conversion. It also works using pointers (and references) to the source and target objects. In simple terms its syntax is:
targetObjPtr = const_cast <targetClassName*>(&sourceObj);
As with the other casting operators, you end up with two objects; the target object is a kind of copy of the source object and the source object is not changed. With all casting operators, the source object is not changed. For simplicity, I illustrate the use of the const_cast operator using fundamental objects. Read and try the following code:
#include <iostream>
using namespace std;
int main()
{
int const myInt = 5;
int *intPtr;
intPtr = const_cast <int*>(&myInt);
cout << *intPtr << “\n”;
*intPtr = 6;
cout << *intPtr;
return 0;
}
The main function starts by having an integer that holds a constant value. Then we have a pointer without any assignment. Next we have the casting to assign the value for the constant int to the pointer. The pointer is now pointing to an object different from the source int object. It has the same value as the constant source value, but it is not constant; it has changed. The rest of the statements illustrate the changing capacity of the pointed object.
This kind of casting can be useful when you have to pass a constant value to a function whose parameter is not constant. The following code illustrates this:
#include <iostream>
using namespace std;
void display(int *intPar)
{
cout << *intPar;
}
int main()
{
int const myInt = 5;
int *intPtr;
display(const_cast<int*>(&myInt));
return 0;
}
Note that the argument in the function call is the const_cast operator with its operands. The return pointer of the operator is the effective argument.
typeid
This operator does not really do conversion. It is used to determine the type of object of an operand. It returns a pointer for the type of object. The syntax to use the typeid operator is
typeid(operand)
You use it with the equal (==) and not-equal (!=) operators. The following code illustrates its use with fundamental objects:
#include <iostream>
#include <typeinfo>
using namespace std;
int main()
{
int a = 7;
int b = 8;
if (typeid(a) == typeid(b))
{
cout << “The types are the same”;
}
return 0;
}
Note that this typeid operator is found in the typeinfo header file. Note the include preprocessing directive for this header file.
In a similar way the typeid operator can be used with instantiated objects. The following code illustrates this:
#include <iostream>
#include <typeinfo>
using namespace std;
class CA
{
};
class CB
{
};
CA caObj1;
CA caObj2;
CB cbObj;
int main()
{
if (typeid(caObj1) == typeid(caObj2))
{
cout << “The types are the same” <<”\n”;
}
if (typeid(caObj1) != typeid(cbObj))
{
cout << “The types are not the same”;
}
return 0;
}
The direction of operation of the casting operators are left-to-right. Casting operators are implicit, explicit, dynamic_cast, static_cast, reinterpret_cast, const_cast and typeid. The calling of the operators look like function calls, but they are operators.
That is it for casting operators. Let us take a break here and continue in the next part of the series.
Chrys
To arrive at any of the parts of this series, just type the corresponding title below and my name, Chrys, in the Search Box of this page and click Search (use menu if available):
Assignment Operators in C++
Arithmetic Operators in C++
Equality and Relational Operators in C++
Logical Operators in C++
Unary Operators in C++
Type Casting Operators in C++
Pointer to Member Operators in C++
Isolated Operators in C++
Operator Precedence in C++
Unary Operators in C++
C++ Operators – Part 5
Introduction
This is part 5 of my series, C++ Operators. A C++ unary operator needs only one operand to work with, normally on its left. In this part of the series we look at Unary Operators in C++. The direction of operation is normally from right to left.; the operand is on the left of the operator.
Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at forchatrans@yahoo.com. That is, contact me for the slightest problem you have about what you are reading.
The Logical Negation Operator !
This is the NOT operator. We have seen it before. It takes a Boolean operand. If the operand is false, it will return true; if it is true, it will return false. In C++ Boolean true can be represented by 1 and Boolean false is represented by 0.
The if-block will be executed in the following code:
#include <iostream>
using namespace std;
int main()
{
if (!(0))
{
cout << “I am tall”;
}
return 0;
}
The if-block is executed, if the condition is true. !(false) gives true.
A practical example for the above code is:
#include <iostream>
using namespace std;
int main()
{
//Let tall means 20 and short means 10
int me = 20;
if (!(me == 10))
{
cout << “I am tall”;
}
return 0;
}
The – Operator
The – operator can have an arithmetic or enumerated type operand. In this article I only talk about the arithmetic type operand. If the value of the operand is a positive number, it changes it to a negative number. If it is a negative number, it changes it to a positive number. This symbol can behave as two operators; negation and addition. In this part of the series, we see it as a negation operator. The following example illustrates this:
#include <iostream>
using namespace std;
int main()
{
signed int int1 = +5;
signed int int2 = -6;
signed int intA = -int1;
signed int intB = -int2;
cout << intA<<”\n”;
cout << intB;
return 0;
}
If you try the above code, the value of intA will be -5 and the value of intB will be +6 (same as 6).
The + Operator
The + operator does the opposite of the – operator. The + operator can also have a pointer type operand. However, in this series I will only talk about the arithmetic operand. Note: like in mathematics, the + operator does not change the sign of a number, when it precedes the signed number. The following code illustrates the use of the + operator (you do not always have to use it):
#include <iostream>
using namespace std;
int main()
{
signed int int1 = +5;
signed int int2 = -6;
signed int intA = +int1;
signed int intB = +int2;
cout << intA<<”\n”;
cout << intB;
return 0;
}
The signs of int1 and int2 are not changed.
The ~ Operator
The ~ operator is an example of what is known as a bitwise operator. I intend to produce a whole series on bitwise operators. I will not address such operators in this series. You do not need bitwise operators for ordinary programming.
The increment Operator
The Increment Operator is, ++. The operand has to be a number (it can also be a pointer but I will not address that). When it is placed in front (prefix) of the operand, it behaves in one way. When it is placed after (postfix) the operand it behaves in another way.
Prefix: When it is prefix, it adds 1 to the operand and returns the incremented operand value. Read and try the following code:
#include <iostream>
using namespace std;
int main()
{
int id1 = 10;
int id2 = ++id1;
cout << id2;
return 0;
}
In the code, initially, 10 is assigned to the object of id1. Then we have a new statement. In the statement you have a new identifier, id2, the assignment operator and then “++id1″. What interest us here is “++id1″, where the increment operator is in front of the identifier. The value the increment operator returns is assigned to the object of id2. If you have tried the code, you would have noticed that the value of id2 is 11. This means, if used prefix, it increments the operand and then returns the incremented content of the operand object.
Postfix: When it is postfix, it returns the operand value before adding 1 to it. The returned value is the original value of the operand. The increased value is the new value of the operand, which is not returned. Read and try the following code.
#include <iostream>
using namespace std;
int main()
{
int id1 = 10;
int id2 = id1++;
cout << id2<<”\n”;
cout << id1;
return 0;
}
If you have tried the above code, you would have noticed that the value for id2 is 10 and the final value for id1 is 11, confirming that the incrementing took place after the value was returned. When it is placed postfix, the direction of operation is left to right and not right to left. Also remember that when it is placed postfix, the value of the operand is returned before it is incremented.
The new and delete Operator
The new operator is the reserved word, new, and the delete operator is the reserved word, delete. The new and delete operators work with dynamic objects. If you do not understand dynamic objects, then read the article I wrote titled, “Dynamic Objects in C++”. To reach the article, type the title of the article and my name Chrys in the Search box of this page and click Search.
The following statement shows how you use the new operator to create a dynamic object of type int:
int *myIntPtr = new int;
The new operator returns a pointer to the dynamic object. You can then use the pointer to access the object. There are two other ways of using the new operator to create a dynamic object, but I will not go into that in this series. You can read the article I wrote for more info on that.
The following statement shows how you use the delete operator to delete a dynamic object (it does not matter the type of dynamic object):
delete myIntPtr;
You begin with the operator and then you follow that with the pointer object identifier. There is another way of using the delete operator, but I will not go into that in this series. You can read the article I wrote for more info on that.
Note: The new and delete reserved words ant not built-in functions, they are built-in operators.
The sizeof Operator
The reserved word, sizeof is not a built-in function, it is a built-in operator. Its operand is either an object type (e.g. char, int, float) or a particular object (identifier of the object). When the operand is an object type the operand goes into parentheses; when it is an object, the parentheses are optional. This operator gives the size of the object type or object in bytes.
For all computers the following expression returns 1, which is the size in bytes of any char:
sizeof(char);
The size of the other fundamental object types vary with computers. The following expression will return the size of an int in your computer.
sizeof(int)
The following code segment displays the size of the int object, myInt:
int myInt = 553;
cout << sizeof myInt;
Note: the size of an int object is the size of the int type; the size of a float object is the size of the float type; the size of a char object is the size of the char type, and so on. Apart from char, the other sizes depend on your computer.
You can also use the sizeof operator to know the size of a particular array. The size of an array is the number of array elements times the size of each element. The following code illustrates this:
#include <iostream>
using namespace std;
int main()
{
float myFlt[15];
cout << sizeof myFlt;
return 0;
}
In my computer, the size of a float is 4, so the output of the above code is 60, determined as 15 times 4, since 15 is the number of elements.
Note that just the name of the array has been used as the operand of sizeof without the [] brackets of the array.
The * and & Operators
The * and & operators are used with pointers. * means the value in the pointed object pointed to by a pointer object. & means the address of an object. The following code illustrates these:
#include <iostream>
using namespace std;
int main()
{
float hisFloat;
float *myPointer = &hisFloat;
*myPointer = 23.5;
cout << *myPointer;
return 0;
}
In the third statement of main, the operand of * is myPointer which is the identifier of an object (pointer object), which has the address of the object, hisFloat. In the second statement the operand of & is hisFloat, which is the identifier of an object (pointed object). The expression created by & returns the address of the object of its operand (hisFloat). The third statement gives hisFloat, the value, 23.5.
Note that when a pointer is created by initialization, * does not mean value of pointed object; it means value (address) in pointer object. Pointer object and pointed object are two different things (two different objects). An object is a region in memory.
The unary operators we have not seen are known as the Type Casting Operators. We shall see that in the next part of the series.
The unary operators are: * & + – ! ˜ ++ — * & new delete sizeof and type casting operators.
Let us take a break here and continue in the next part of the series.
Chrys
To arrive at any of the parts of this series, just type the corresponding title below and my name, Chrys, in the Search Box of this page and click Search (use menu if available):
Assignment Operators in C++
Arithmetic Operators in C++
Equality and Relational Operators in C++
Logical Operators in C++
Unary Operators in C++
Type Casting Operators in C++
Pointer to Member Operators in C++
Isolated Operators in C++
Operator Precedence in C++