C Programming and Computer Geeks

Search MY Blog

Sunday, 1 December 2013

Understanding Pointers in C/C++

When we declare a variable in C/C++ etc.. like int x or int y , it tells the compiler to reserve the space of two bytes(Size depends on OS Platforms/Compilers ) in the memory to store the integer type value and identify the storage location in the memory by 'x' or 'y' etc.
So every variable has three properties 1. Identifier (Name like x or y) 2. Value(x=10 or y=15 etc.) 3. Its address (hexadecimal) in the Temporary Memory i.e. RAM. Since compiler makes our job simpler by giving an opportunity to know only the variable’s name and its value then in normal situation we have no need to worry about the location or address of the variable. But in advanced programming and certain types of problems we have to handle and use the address of variables. So the concept of Pointers solves this problem. 
We can say Pointer Definition as "Pointers are those variables which holds the address of another variable”. In C/C++ we can see the “Address” or “Memory Location Number” of any variable by using "&" i.e. if we declare a variable 'x' eg: int x; we can see its address by printf statement as follows printf("\n %d", &x);
Now to handle the address of variables we have the facility to declare the Pointer variable like this int *p; this statement tells the compilers to reserve the space in memory to store the address of integer type variable. To assign the address of any integer type variable to 'p' we have to write the statement like p = &x; 

Example Program:

Understanding Pointers in C
Pointers in C



void main()
{
 int x = 34; //variable declaration and definition.
 int *p; //pointer declaration.

 /* p is a pointer which points to a integer variable or ‘p’   is  a pointer which holds the address of an integer variable..  */
 p = &x; //Assigning the address of variable x to pointer ‘p’.
 printf("Address of variable x is : %x",p);//prints the  address  of variable x. here %x displays Address in Hexa  decimal format.
}

Clickhere for more C Tutorials and Concepts.



Saturday, 30 November 2013

Microsoft Word Shortcut Keys

The followings are shortcut keys and mouse shortcuts that can be used for Microsoft Word

Mouse shortcuts

Double-click (on a word)
Select the word.
Single-click (anywhere in asentence) + Holding CTRL
Select the entire sentence.
Triple-click (anywhere in a paragraph)
Select the entire paragraph.
Click, hold, drag, then release
Select text from the click position to release position.
Click first position, hold SHIFT key, then click 2nd position
Select text from the 1st position to the 2nd position.
Hold ALT key, then click and drag
Vertical select text.
Hold CTRL key, then scroll wheel
Zoom in/out.


Keyboard shortcuts
Ctrl + A
Select all (including text, graphics).
Ctrl + B
Bold.
Ctrl + I
Italic.
Ctrl + U
Underline.
Ctrl + C
Copy.
Ctrl + V
Paste.
Ctrl + X
Cut.
Ctrl + F
Find.
Ctrl + Z
Undo.
Ctrl + Y
Redo.
Ctrl + P
Open the print dialog.
Ctrl + K
Insert link.
Ctrl + L
Left align.
Ctrl + E
Center align.
Ctrl + R
Right align.
Ctrl + M
Indent.
Ctrl + (left arrow)
Moves one word to the left.
Ctrl + (right arrow)
Moves one word to the right.
Ctrl + (up arrow)
Moves cursor to the beginning of the paragraph.
Ctrl + (down arrow)
Moves cursor to the end of the paragraph.
Ctrl + Shift + F
Change font.
Ctrl + Shift + *
View/hide non-printing characters.
Ctrl + Del
Deletes word to the right of cursor.
Ctrl + Backspace
Deletes word to the left of cursor.
Ctrl + End
Moves cursor to the end of document.
Ctrl + Home
Moves cursor to the beginning of document.
Ctrl + Spacebar
Reset highlighted text to the default font.
Ctrl + 1
Single-space.
Ctrl + 2
Double-space.
Ctrl + 5
1.5-line.
Ctrl + Alt + 1
Format text: heading 1.
Ctrl + Alt + 2
Format text: heading 2.
Ctrl + Alt + 3
Format text: heading 3.
F1
Help.
F4
Repeat the last action
F5
Go to .
F7
Spelling and grammar.
F12
Save as.
F8 then (left arrow)
Increase selection to the left by one character
F8 then (right arrow)
Increase selection to the right by one character
Ctrl + F1
Task Pane.
Ctrl + F2
Print preview.
Alt + Ctrl + F2
New document.
Shift + F3
Cycle between capitalized formats
Ctrl + Insert
Copy.
Shift + Insert
Paste.
Shift + End
Select from current position to the end of the line.
Shift + Home
Select from current position to the beginning of the line.
Ctrl + Shift + (left arrow)
Select from current position to the beginning of the word.
Ctrl + Shift + (right arrow)
Select from current position to the end of the word.
Ctrl + Shift + (up arrow)
Select from current position to the
Shift + Page Up
One screen page up.
Shift + Page Down
One screen page down.
Shift + F7
Thesaurus check selected text.
Shift + F12
Save.
Ctrl + Shift + F12
Print.
Alt + Shift + D
Insert the current date.
Alt + Shift + T
Insert the current timen


Click here for more Tips & Tricks .


Search This Blog