Translate

Thursday, 23 May 2013

How to Put on Weight (Men)

  1. Drink water. Drinking a great quantity of water is essential to increasing weight. As a way to have the required energy to maintain healthy whilst gaining weight, it is certainly critical to take in plenty of water. Even drinking a half gallon of water or more is suggested. 
  2. Copy and paste the following HTML code into your own Website code:
  3. Try to eat a lot more. There may come a stage when you will notice that you're not gaining weight anymore. If you have not gained much weight in a couple of weeks then it is definitely time to incorporate 250 more calories per day to your daily diet. Whenever you discover you haven't gained much weight for a few weeks, then increase your intake by about 250 calories per day to your diet.
  4. Raise Caloric Daily Allowance.Given that you already know the number of calories you consume each day, increase it by 500 calories. This might seem high, but should you spread it out through 5 or 6 tiny meals it will not really feel like that significant of a switch. Keep in mind, a skinny person eats like a skinny person and a huge person takes in additional calories.
  5. Percentage of Body Fat. Weighing oneself allows you monitor where you are and where you desire to be. Checking your body fat percentage is essential to ensure that the weight that you are putting on is transforming from skinny to muscle instead of fat.
  6. Keep Track of Calories. Prior to changing your diet, add up the number of calories you take in during a typical day. It really is vital that you determine as near to the actual quantity as is possible to ensure that you know the number of to add.
  7. Lift Weights. Merely eating and performing no physical exercise will convert you from a slim person to a chubby person. It really is essential to stay active in order to stay healthy, specifically weightlifting. Lifting weights will enable you convert the increased calorie in-take into muscle. Based upon on what your objective is determines the volume of weightlifting you should do. If you would like to sculpt then lift a couple of days a week and perform a great deal of repetitions, however if you are looking to develop muscle then lift at least five days a week and increase the weight, but do less repetitions.
  8. Get Plenty of Sleep. Having at least 8 hours of sleep every night consistently is a crucial aspect that is frequently neglected. Obtaining a restful night of sleep allows you sustain energy.

Operators in C Programming 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 following type of operators:
·         Arithmetic Operators
·         Relational Operators
·         Logical Operators
·         Bitwise Operators
·         Assignment Operators
·         Misc Operators
This tutorial will explain the arithmetic, relational, and logical, bitwise, assignment and other operators one by one.

Arithmetic Operators

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

Operator
Description
Example
+
Adds two operands
A + B will give 30
-
Subtracts second operand from the first
A - B will give -10
*
Multiply both operands
A * B will give 200
/
Divide numerator by de-numerator
B / A will give 2
%
Modulus Operator and remainder of after an integer division
B % A will give 0
++
Increment operator increases integer value by one
A++ will give 11
--
Decrement operator decreases integer value by one
A-- 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:

Operator
Description
Example
==
Checks if the value of two operands is equal or not, if yes then condition becomes true.
(A == B) is not true.
!=
Checks if the value of two operands is 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:

Operator
Description
Example
&&
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.

Bitwise Operators

Bitwise operator works on bits and perform bit by bit operation. The truth tables for &, |, and ^ are as follows:
p
q
p & q
p | q
p ^ q
0
0
0
0
0
0
1
0
1
1
1
1
1
1
0
1
0
0
1
1
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 Bitwise operators supported by C language are listed in the following table. Assume variable A holds 60 and variable B holds 13 then:

Operator
Description
Example
&
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 -60 which is 1100 0011
<< 
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:

Operator
Description
Example
=
Simple assignment operator, Assigns values from right side operands to left side operand
C = 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 operand
C += 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 operand
C -= 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 operand
C *= 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 operand
C /= A is equivalent to C = C / A
%=
Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand
C %= A is equivalent to C = C % A
<<=
Left shift AND assignment operator
C <<= 2 is same as C = C << 2
>>=
Right shift AND assignment operator
C >>= 2 is same as C = C >> 2
&=
Bitwise AND assignment operator
C &= 2 is same as C = C & 2
^=
bitwise exclusive OR and assignment operator
C ^= 2 is same as C = C ^ 2
|=
bitwise inclusive OR and assignment operator
C |= 2 is same as C = C | 2

Misc Operators sizeof & ternary

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

Operator
Description
Example
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 Expression
If 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 get 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 

Storage Classes in C Programming Language



A storage class defines the scope (visibility) and life time of variables and/or functions within a C Program. These specifiers precede the type that they modify. There are following storage classes which can be used in a C Program
·         auto
·         register
·         static
·         extern

The auto Storage Class

The auto storage class is the default storage class for all local variables.
{
   int mount;
   auto int month;
}
The example above defines two variables with the same storage class, auto can only be used within functions, i.e. local variables.

The register Storage Class

The register storage class is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and can't have the unary '&' operator applied to it (as it does not have a memory location).
{
   register int  miles;
}
The register should only be used for variables that require quick access such as counters. It should also be noted that defining 'register' goes not mean that the variable will be stored in a register. It means that it MIGHT be stored in a register depending on hardware and implementation restrictions.

The static Storage Class

The static storage class instructs the compiler to keep a local variable in existence during the lifetime of the program instead of creating and destroying it each time it comes into and goes out of scope. Therefore, making local variables static allows them to maintain their values between function calls.
The static modifier may also be applied to global variables. When this is done, it causes that variable's scope to be restricted to the file in which it is declared.
In C programming, when static is used on a class data member, it causes only one copy of that member to be shared by all objects of its class.
#include <stdio.h>
 
/* function declaration */
void func(void);
 
static int count = 5; /* global variable */
 
main()
{
   while(count--)
   {
      func();
   }
   return 0;
}
/* function definition */
void func( void )
{
   static int i = 5; /* local static variable */
   i++;
 
   printf("i is %d and count is %d\n", i, count);
}
You may not understand this example at this time because I have used function and global variables which I have not explained so far. So for now let us proceed even if you do not understand it completely. When the above code is compiled and executed, it produces following result:
i is 6 and count is 4
i is 7 and count is 3
i is 8 and count is 2
i is 9 and count is 1
i is 10 and count is 0

The extern Storage Class

The extern storage class is used to give a reference of a global variable that is visible to ALL the program files. When you use 'extern' the variable cannot be initialized as all it does is point the variable name at a storage location that has been previously defined.
When you have multiple files and you define a global variable or function which will be used in other files also, then extern will be used in another file to give reference of defined variable or function. Just for understanding extern is used to declare a global variable or function in another files.
The extern modifier is most commonly used when there are two or more files sharing the same global variables or functions as explained below.
First File: main.c
#include <stdio.h>
 
int count ;
extern void write_extern();
 
main()
{
   count = 5;
   write_extern();
}
Second File: write.c
#include <stdio.h>
 
extern int count;
 
void write_extern(void)
{
   printf("count is %d\n", count);
}
Here extern keyword is being used to declare count in the second file where as it has its definition in the first file main.c. Now compile these two files as follows:
 $gcc main.c write.c
This will produce a.out executable program, when this program is executed, it produces following result:
5

Constants in C programming Language



The constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals.
Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are also enumeration constants as well.
The constants are treated just like regular variables except that their values cannot be modified after their definition.

Integer literals

An integer literal can be a decimal, octal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, 0 for octal, and nothing for decimal.
An integer literal can also have a suffix that is a combination of U and L, for unsigned and long, respectively. The suffix can be uppercase or lowercase and can be in any order.
Here are some examples of integer literals:
212         /* Legal */
215u        /* Legal */
0xFeeL      /* Legal */
078         /* Illegal: 8 is not an octal digit */
032UU       /* Illegal: cannot repeat a suffix */
Following are other examples of various type of Integer literals:
85         /* decimal */
0213       /* octal */
0x4b       /* hexadecimal */
30         /* int */
30u        /* unsigned int */
30l        /* long */
30ul       /* unsigned long */

Floating-point literals

A floating-point literal has an integer part, a decimal point, a fractional part, and an exponent part. You can represent floating point literals either in decimal form or exponential form.
While representing using decimal form, you must include the decimal point, the exponent, or both and while representing using exponential form, you must include the integer part, the fractional part, or both. The signed exponent is introduced by e or E.
Here are some examples of floating-point literals:
3.14159       /* Legal */
314159E-5L    /* Legal */
510E          /* Illegal: incomplete exponent */
210f          /* Illegal: no decimal or exponent */
.e55          /* Illegal: missing integer or fraction */

Character constants

Character literals are enclosed in single quotes e.g., 'x' and can be stored in a simple variable of char type.
A character literal can be a plain character (e.g., 'x'), an escape sequence (e.g., '\t'), or a universal character (e.g., '\u02C0').
There are certain characters in C when they are proceeded by a back slash they will have special meaning and they are used to represent like newline (\n) or tab (\t). Here you have a list of some of such escape sequence codes:
Escape sequence
Meaning
\\
\ character
\'
' character
\"
" character
\?
? character
\a
Alert or bell
\b
Backspace
\f
Form feed
\n
Newline
\r
Carriage return
\t
Horizontal tab
\v
Vertical tab
\ooo
Octal number of one to three digits
\xhh . . .
Hexadecimal number of one or more digits
Following is the example to show few escape sequence characters:
#include <stdio.h>
 
int main()
{
   printf("Hello\tWorld\n\n");
 
   return 0;
}
When the above code is compiled and executed, it produces following result:
Hello   World
 

String literals

String literals or constants are enclosed in double quotes "". A string contains characters that are similar to character literals: plain characters, escape sequences, and universal characters.
You can break a long lines into multiple lines using string literals and separating them using whitespaces.
Here are some examples of string literals. All the three forms are identical strings.
"hello, dear"
 
"hello, \
 
dear"
 
"hello, " "d" "ear"

Defining Constants

There are two simple ways in C to define constants:
1.      Using #define preprocessor.
2.      Using const keyword.

The #define Preprocessor

Following is the form to use #define preprocessor to define a constant:
#define identifier value
Following example explains it in detail:
#include <stdio.h>
 
#define LENGTH 10   
#define WIDTH  5
#define NEWLINE '\n'
 
int main()
{
 
   int area;  
  
   area = LENGTH * WIDTH;
   printf("value of area : %d", area);
   printf("%c", NEWLINE);
 
   return 0;
}
When the above code is compiled and executed, it produces following result:
value of area : 50

The const Keyword

You can use const prefix to declare constants with a specific type as follows:
const type variable = value;
Following example explains it in detail:
#include <stdio.h>
 
int main()
{
   const int  LENGTH = 10;
   const int  WIDTH  = 5;
   const char NEWLINE = '\n';
   int area;  
   
   area = LENGTH * WIDTH;
   printf("value of area : %d", area);
   printf("%c", NEWLINE);
 
   return 0;
}
When the above code is compiled and executed, it produces following result:
value of area : 50
Note that it is a good programming practice to define constants in CAPITALS.

Total Pageviews