Archive for 2014

Operators in C language

An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C language is rich in built-in operators and provides the following types of operators:

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Bit-wise Operators
  • Assignment Operators
  • Misc Operators
Arithmetic Operators:
Following table shows all the arithmetic operators supported by C language. Assume variable A holds 10 and variable B holds 20 then:

OperatorDescriptionExample
+Adds two operandsA + B will give 30
-Subtracts second operand from the firstA - B will give -10
*Multiplies both operandsA * B will give 200
/Divides numerator by de-numeratorB / A will give 2
%Modulus Operator and remainder of after an integer divisionB % A will give 0
++Increments operator increases integer value by oneA++ will give 11
--Decrements operator decreases integer value by oneA-- will give 9

Relational Operators:
Following table shows all the relational operators supported by C language. Assume variable A holds 10 and variable B holds 20, then:


OperatorDescriptionExample
==Checks if the values of two operands are equal or not, if yes then condition becomes true.(A == B) is not true.
!=Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.(A != B) is true.
>Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.(A > B) is not true.
<Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.(A < B) is true.
>=Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.(A >= B) is not true.
<=Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.(A <= B) is true

Logical Operators:
Following table shows all the logical operators supported by C language. Assume variable A holds 1 and variable B holds 0, then:

OperatorDescriptionExample
&&Called Logical AND operator. If both the operands are non-zero, then condition becomes true.(A && B) is false.
||Called Logical OR Operator. If any of the two operands is non-zero, then condition becomes true.(A || B) is true.
!Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.!(A && B) is true.

Bit-wise Operators:
Bit-wise operator works on bits and perform bit-by-bit operation. The truth tables for &, |, and ^ are as follows:

pqp & qp | qp ^ q
00000
01011
11110
10011

Assume if A = 60; and B = 13; now in binary format they will be as follows:

A = 0011 1100

B = 0000 1101

-----------------

A&B = 0000 1100

A|B = 0011 1101

A^B = 0011 0001

~A  = 1100 0011

The Bit-wise operators supported by C language are listed in the following table. Assume variable A holds 60 and variable B holds 13, then:
OperatorDescriptionExample
&Binary AND Operator copies a bit to the result if it exists in both operands.(A & B) will give 12, which is 0000 1100
|Binary OR Operator copies a bit if it exists in either operand.(A | B) will give 61, which is 0011 1101
^Binary XOR Operator copies the bit if it is set in one operand but not both.(A ^ B) will give 49, which is 0011 0001
~Binary Ones Complement Operator is unary and has the effect of 'flipping' bits.(~A ) will give -61, which is 1100 0011 in 2's complement form.
<<Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand.A << 2 will give 240 which is 1111 0000
>>Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand.A >> 2 will give 15 which is 0000 1111

Assignment Operators:
There are following assignment operators supported by C language:

OperatorDescriptionExample
=Simple assignment operator, Assigns values from right side operands to left side operandC = A + B will assign value of A + B into C
+=Add AND assignment operator, It adds right operand to the left operand and assign the result to left operandC += A is equivalent to C = C + A
-=Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operandC -= A is equivalent to C = C - A
*=Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operandC *= A is equivalent to C = C * A
/=Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operandC /= A is equivalent to C = C / A
%=Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operandC %= A is equivalent to C = C % A
<<=Left shift AND assignment operatorC <<= 2 is same as C = C << 2
>>=Right shift AND assignment operatorC >>= 2 is same as C = C >> 2
&=Bitwise AND assignment operatorC &= 2 is same as C = C & 2
^=bitwise exclusive OR and assignment operatorC ^= 2 is same as C = C ^ 2
|=bitwise inclusive OR and assignment operatorC |= 2 is same as C = C | 2
Misc Operators ↦ sizeof & ternary:

There are few other important operators including sizeof and ? : supported by C Language.

OperatorDescriptionExample
sizeof()Returns the size of an variable.sizeof(a), where a is integer, will return 4.
&Returns the address of an variable.&a; will give actual address of the variable.
*Pointer to a variable.*a; will pointer to a variable.
? :Conditional ExpressionIf Condition is true ? Then value X : Otherwise value Y

Operators Precedence in C:

Operator precedence determines the grouping of terms in an expression. This affects how an expression is evaluated. Certain operators have higher precedence than others; for example, the multiplication operator has higher precedence than the addition operator.

For example x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has higher precedence than +, so it first gets multiplied with 3*2 and then adds into 7.

Here, operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom. Within an expression, higher precedence operators will be evaluated first.

Category Operator Associativity 
Postfix () [] -> . ++ - -  Left to right 
Unary + - ! ~ ++ - - (type)* & sizeof Right to left 
Multiplicative  * / % Left to right 
Additive  + - Left to right 
Shift  << >> Left to right 
Relational  < <= > >= Left to right 
Equality  == != Left to right 
Bitwise AND Left to right 
Bitwise XOR Left to right 
Bitwise OR Left to right 
Logical AND && Left to right 
Logical OR || Left to right 
Conditional ?: Right to left 
Assignment = += -= *= /= %=>>= <<= &= ^= |= Right to left 
Comma Left to right 
Monday, November 3, 2014

C Hello World Example

C Hello World Example:

A C program basically consists of the following parts:


  • Preprocessor Commands
  • Functions
  • Variables
  • Statements & Expressions
  • Comments


Let us look at a simple code that would print the words "Hello World":

#include <stdio.h>

int main()
{
   /* my first program in C */
   printf("Hello, World! \n");
   
   return 0;
}

Let us look various parts of the above program:

The first line of the program #include <stdio.h> is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation.

The next line int main() is the main function where program execution begins.

The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in the program. So such lines are called comments in the program.

The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen.

The next line return 0; terminates main()function and returns the value 0.

Compile & Execute C Program:

Lets look at how to save the source code in a file, and how to compile and run it. Following are the simple steps:

  • Open a text editor and add the above-mentioned code.
  • Save the file as hello.c
  • Open a command prompt and go to the directory where you saved the file.
  • Type gcc hello.c and press enter to compile your code.
  • If there are no errors in your code the command prompt will take you to the next line and would generate a.out executable file.
  • Now, type a.out to execute your program.
  • You will be able to see "Hello World" printed on the screen

Semicolons and Comments in C language

Semicolons and Comments in C language:

Semicolons are very important in C programming language. They are used as terminators.
They are used to terminate a statement. They are used at the end of every statement. You will get an error if you forget to add semicolon at the end of every statement.

In C program, the semicolon is a statement terminator. That is, each individual statement must be ended with a semicolon. It indicates the end of one logical entity.
For example, following are two different statements:
printf("Hello, World! \n");
return 0;

Comments are used in C language for better understanding of the program. Comments are like helping text in your C program and they are ignored by the compiler. They start with /* and terminates with the characters */ as shown below:

/* my first program in C */

Keywords in C programming Language

Keywords in C programming Language:

There are 31 Keywords/Reserved words in C programming language. 
The following list shows the reserved words in C. These reserved words may not be used as constant or variable or any other identifier names.

autoelselongswitch
breakenumregistertypedef
caseexternreturnunion
charfloatshortunsigned
constforsignedvoid
continuegotosizeofvolatile
defaultifstaticwhile
dointstruct_Packed
double   

Keywords in C programming language must not be used as a variable name or as a constant.
If you do so, then you will get an error in your program.

Variables in C Programming Language

Variables in C Programming Language:

A variable is a memory location whose value can change (vary) during run-time, which is when a program is running. Most of the memory locations declared in a program are variables. 

In a program that inputs the radius of any circle and then calculates and outputs the circle’s area, a programmer would declare variables to store the values of the radius and area; doing this allows those values to vary while the program is running.

Variable Naming:

  • The name must begin with a letter.
  • The name can contain only letters, numbers, and the underscore character. No punctuation marks, spaces, or other special characters are allowed in the name.
  • The name cannot be a keyword. 
  • Names in C are case sensitive.

Variable Declaration:

Following syntax is used in declaration of the variables:
"Data_type Variable_name;"
Data Type defined the type of data that is to be stored in the variable while variable name can be anything according to the roles of naming variables.

Data Types: 

Following are different types of data type:
Basic Types:
They are arithmetic types and consists of the two types: (a) integer types and (b) floating-point types.
Enumerated types:
They are again arithmetic types and they are used to define variables that can only be assigned certain discrete integer values throughout the program.
The type void:
The type specifier void indicates that no value is available.
Derived types:
They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types.

Integer Data Type:

Following table gives you details about standard integer types with its storage sizes and value ranges:


To get the exact size of a type or a variable on a particular platform, you can use the sizeof operator. The expressions sizeof(type) yields the storage size of the object or type in bytes.

Floating Point Data Type:

Following table gives you details about standard floating-point types with storage sizes and value ranges and their precision:

To get the exact size of a type or a variable on a particular platform, you can use the sizeof operator. The expressions sizeof(type) yields the storage size of the object or type in bytes.

The Void Type:

The void type specifies that no value is available. It is used in three kinds of situations:

Function returns as void:
There are various functions in C which do not return value or you can say they return void. A function with no return value has the return type as void. For example void exit (int status);

Function arguments as void:
There are various functions in C which do not accept any parameter. A function with no parameter can accept as a void. For example, int rand(void);

Pointers to void :
A pointer of type void * represents the address of an object, but not its type. For example a memory allocation function void *malloc( size_t size ); returns a pointer to void which can be casted to any data type.


C Programming Language

C Programming Language:



In computing, C is a general-purpose programming language initially developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs.
Like most imperative languages(In computer science terminologies, imperative programming is a programming paradigm(A programming paradigm is a fundamental style of computer programming, a way of building the structure and elements of computer programs.) that describes computation in terms of statements that change a program state.) in the ALGOL(ALGOrithmic Language) tradition, C has facilities for structured programming(aimed at improving the clarity, quality, and development time of a program) and allows lexical variable scope and recursion(a method where the solution to a problem depends on solutions to smaller instances of the same problem), while a static type system prevents many unintended operations.
Its design provides constructs that map efficiently to typical machine instructions(a set of instructions executed directly by a computer), and therefore it has found lasting use in applications that had formerly been coded in assembly language(An assembly language is a low-level programming language for a computer, or other programmable device, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture's machine code instructions), most notably system software(computer software designed to operate and control the computer hardware) like the Unix(a multitasking, multi-user computer operating system that exists in many variants) computer operating system(An operating system (OS) is software that manages computer hardware and software resources and provides common services for computer programs).

Many later languages have borrowed directly or indirectly from C, including D, Go, Rust, Java, JavaScript, Limbo, LPC, C#, Objective-C, Perl, PHP, Python etc.

Design of C Language:

C is an imperative (procedural) language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language, such as in system programming.

Given below is the simplest code written in C which displays Hello Wolrd! to the user.

/* Hello World program */

#include<stdio.h>

main()
{
    printf("Hello World");

}

This is just some introduction to the  C Programming language.
However, it is a vast and powerful language which can be used for different purposes.

Computer Fundamentals By Pradeep K. Sinha & Priti Sinha

Computer Fundamentals By Pradeep K. Sinha & Priti Sinha




Download Now From Here:

Calculus By Thomas Finny Free Download

Calculus by Thomas Finny 9th Edition Free Download:

Free Download Calculus book by Thomas Finny



Download This Book from Here:

Please Provide feedback about this post

How to Rename your Recycle Bin?

How to Rename your Recycle Bin :

Lets see how to rename Recycle Bin :

Step 1 : 
Click Start / Run.

Step 2 : 
Type regedit and press enter.

Step 3 : 
Open the HKEY_CLASSES_ROOT folder.

Step 4 : 
Open the CLSID folder.

Step 5 : 
Open the {645FF040-5081-101B-9F08-00AA002F954E} folder.

Step 6 : 
Open the ShellFolder folder.

Step 7 : 
Change the "Attributes" data value from "40 01 00 20" to "50 01 00 20". Once completed change the "CallForAttributesdword value to "0x00000000" (double click and change value data to 0). You must change both of these values to get the rename to appear.


After performing the above steps you will be able to rename the icon like any other icon. Right-click the Recycle Bin icon on the desktop and click Rename and rename it to whatever you wish.

Please provide feedback about this post.
Thank you.
Tuesday, August 19, 2014

How to Change your Folder Background?

How to Change your Folder Background:

Everybody wants changes in their personal things. I am sure you do too.
This article is to teach you how to change the background of any folder.

So lets get started : 


Step 1 :
Have the Folder you want to put the background on open!

Step 2 :
Open up Notepad and simply paste this code.

"
[{BE098140-A513-11D0-A3A4-00C04FD706EC}]

iconarea_image=***Picture Location Here!***\***Name of File!***

"
Step 3: 
Go to your picture (the picture you want to use!) and right click and select
properties and find the file location for example lets say my file is in "my hard drive". It would be located at "C:\\" understand? copy the location!

Step 4: 
Now go back to your text document (notepad) and where it says ***Picture
Location Here!*** paste the location...you copied in the previous step!

Step 5: 
Now after you've done that where it says ***Name of File!*** type the name of the file including the .jpg .bmp .bip. jpeg etc.

Step 6: 
Save the text document as "desktop.ini" be sure to remember the .ini extension! click Save as "All Files" not "Text Document" and save the document in the folder where u want the background to be!

Now just close the folder and open it again it should show the picture as a

background!

Please Provide Feedback about this post.
Thank you.

What is my IP, What is IP Adress?

What is IP Address?

No doubt you have heard to the word 'IP Address'.
Tell me explain what is IP address.


Definition :

An IP address is a product of modern computer technology that allows one computer to communicate with the other computer via Internet.
IP stands for 'Internet Protocol', so an IP address is an internet protocol address.

An IP address is an identifier for a computer on a TCP/IP (Transfer control Protocol/ Internet Protocol) network.

Format of IP Address :

The format of IP address is a 32-bit numeric address written as four numbers separated by periods. Each number can be zero to 255. For example, 1.160.10.240 could be an IP address. An IP address consists of four numbers, each of which contains one to three digits, with a single dot (.) separating each number or set of digits. 
This innocuous-looking group of four numbers is the key that empowers you and me to send and retrieve data over our Internet connections, ensuring that our messages, as well as our requests for data and the data we've requested, will reach their correct Internet destinations.

Types of IP Address :

There are two types of IP Address :


  • Dynamic IP Address (Temporary and are assigned each time a computer accesses the Internet. Limited number of static IP addresses are available)
  • Static IP Address (Used for online gaming, or any other purpose where users need to make it easy for other computers to locate and connect to them. Easy access can also be facilitated when using a dynamic IP address)
Note : Static IP addresses are considered somewhat less secure than dynamic IP addresses.

Classes of IP :

There are five classes of available IP ranges: Class A, Class B, Class C, Class D and Class E, while only A, B, and C are commonly used. Each class allows for a range of valid IP addresses. There details are given Below:


This all is the basic information about IP address which should be known to every Geek and computer developer.

What is my IP?

If you want to find your own IP address, you can right 'what is my IP address' on google which will show what your IP Address is.
For example my IP is : 39.37.168.58



Please Provide feedback about this Post.
Thank you.

Friday, August 15, 2014

How to type Copyright Symbol using Keyboard

Typing Copyright Symbol using Keyboard :

Copyright Symbol is used in copyright notices for works. This symbol is described in United States 'Copyright law'. It is used to describe what the data or work that is being displayed and provided to anyone is originally claimed to the owner of the data or work.

This can be inserted in any document or data or code to describe that this work is copyright protected.

It can be inserted by using a keyboard on your computer.

To do this, you have to use the Alt symbol on your keyboard (Last line of keyboard, on both sides of the space) with a combination of code.

Press Alt key and then press the combination of numbers 0169 (ALT+0169).


If you successfully did that then this symbol © will appear which is the copyright symbol.


Please provide feedback about this post.
Thank you.


Thursday, August 14, 2014

What is the Difference Between ROM and RAM?

Difference Between ROM and RAM :

RAM and ROM are both different types of memories used in computer to make it fast and to enable it to access information stored in the computer.
Details are given below :


ROM :

ROM stands for 'Read Only Memory'. ROM is a non-volatile memory(That require power to maintain the stored information). It is a for of data storage that cannot be easily altered or reprogrammed. It only allows reading. It can not be edited. ROM is a memory that comes within the computer which is pre-written to hold the instructions for booting-up the computer. Data remains stored in ROM even when the power is cut off (When computer is turned off). Means ROM does not require a constant source of power to retain the information. Data is stored permanently on ROM. It is slower than RAM.
There are different types of ROM :
1) PROM (Programmable read-only memory)
2) EPROM (Erasable Programmable read-only memory)
3) EEPROM (Electrically Erasable Programmable read-only memory)

RAM :

RAM stands for 'Random Access Memory'. RAM is a volatile memory(That does not require power to maintain the stored information). It is a form of data storage that can be accessed randomly at any time. RAM allows the computer to read and write the data quickly to run applications. Data stays in RAM as long as the computer is running, and gets deleted as soon as the computer is switched off. Data is stored temporarily in the RAM. It is faster than ROM.
There are two types of RAM :
1) SRAM (Static Random Access Memory)
2) DRAM (Dynamic Random Access Memory)



Please provide feedback about this post.
Thank you.


What Is the Main difference between CV (Curriculum Vitae) and Resume?

Difference Between CV (Curriculum Vitae) And Resume :


The main difference between a CV (Curriculum Vitae) and Resume is Length.
Some Details of these two are given below:

CV(Curriculum Vitae) :
           
CV stands for 'Curriculum vitae'. Curriculum Vitae means 'Course of Life'.
A CV is a summary of a person's name,contact information, education, honors, presentation, skills and experience in a detailed manner. CV is larger in length than Resume. There is no page limit in CV. A CV is more detailed than Resume and describes a person's educational details, publications, awards, affiliations, and other academic accomplishments. Curriculum Vitae is used in UK (United Kingdom). Minimum length of Curriculum Vitae is two pages. In Europe, The Middle East, Africa and Asia employers expect CV instead of Resume from the Job seekers. In United States, a CV is used primarily when applying for academic, education or scientific.

Resume :

Resume is commonly written as 'Résumé'.
Resume consist of one or two pages. It provides the information about a person in a relevant manner. It means the a Resume is not detailed but it provides only the important details about a person. It provides information about a person's name, contact information, education and work experience. It is mostly used for job applications. Typically, a Resume is used to apply for Business, Industry, Governmental and non-profit jobs. The main purpose of the resume is to get a job interview. It is used to make a good first impression to get a job.


Please Provide Feedback about this post.
Thank you.




Popular Post

Geek Fixes. Powered by Blogger.

Translate

- Copyright © Geek Fixes -Amazing Wallpapers- Powered by Blogger - Designed by Adeel Sarwar