Showing posts with label Whole Computer in your pocket / wallet. Show all posts
Showing posts with label Whole Computer in your pocket / wallet. Show all posts

Saturday, July 18, 2009

Difference between pointer and reference in C++

pointer and reference in c

Puppy! Can Move/Change? -  is a *Pointer in C++

reference in c

Statue! – Can’t change  - is a &reference in C++

Correct code -

int *p = &i;

int k;

p = &k;

Incorrect code -

int &b = a;

int c;

int &b = c;

While creating a reference, it has to be necessarily initialised to some variable or an object. Trying to create a standalone reference i.e. int &b; and then assigning it to some variable i.e. b=a; will not only generate an error, but would also be meaningless, since at the time of its creation itself, a reference has to refer to some variable.

Although references are internally maintained using pointers, there's a subtle difference between a pointer and a reference. The address contained in a pointer variable may be changed at any point in the program that makes it a flexible connection. However a reference once created, cant refer to any other object thus it is a rigid connection.

A pointer has to be de-referenced before you can access the value at the address contained in it. A reference is moreover a direct connection as its just another name for the same memory location.

You can have an array of pointers whereas you cannot have an array of references.

 

 

Tuesday, July 14, 2009

Carry your OS in a pen drive

You can carry your OS in the pen drive. Isn’t it amazing. Most of the time it is very heavy and inconvenient to carry laptops with you. But getting a PC wherever you travels is easy these days. So What you have to do is plug in the pen drive in the PC available. Make that PC boot from pen drive by BIOS setting. and once the PC is booted enjoy the altogether all your PC with your desk tops, your documents, your database, your web server, Your web site and what not. This is possible with Linux. preferred flavor would be Ubuntu for which it is available in two flavors

usb-linux

1. Desktop Edition

2. Server Edition.

But the Server Edition is not provided with GUI / Xwindows. But if you want it on it Don’t worry. First install the desktop edition. and then upgrade the desktop edition to server by installing the additional packages. (This is the simplest way to do it I encountered rather that downloading Xwindows and installing it)

Steps to install Ubuntu

Ubuntu 9.04 has the self explanatory steps after inserting the CD in the drive. (Like Windows)

For older version or manual installation you can follow the following steps.

Steps in detail for old version/ manual installation 

And most of the users will be moved and attracted by the following Ubuntu promise.

The Ubuntu promise 
  • Ubuntu will always be free of charge, including enterprise releases and security updates.
  • Ubuntu comes with full commercial support from Canonical and hundreds of companies around the world.
  • Ubuntu includes the very best translations and accessibility infrastructure that the free software community has to offer.
  • Ubuntu CDs contain only free software applications; we encourage you to use free and open source software, improve it and pass it on.

(If you register online on the Ubuntu site and ask for the installation CD, they will send it to you free of charge. )

Followers