Tutorspoint.com is an excellent site, which caters to all queries of programming assignment help, regarding java assignments related to any topics of elements of C language assignment help with quality solutions.
Since all the programming assignment writing help is offered at reasonable rates, Tutorspoint expert service is highly recommended by students worldwide from many universities of U.S. America, Australia, Canada, Germany, Ireland, and Denmark
Tutorspoint java assignment experts are offering outstanding service in solving problems related to programming assignment help at very low cost to university and college students.
The Elements of C
C character set
In order to develop its language the following characters are used, they are
a) Alphabets-It consists of uppercase letters A...Z and lower case letters a...z.
b) Digits- 0,1,2…9
c) Special characters- , Comma , & Ampersand , . Dot, ^ Caret; Semicolon, * Asterisk, Colon,> Greater than sign,! Exclamation Mark, ( Opening Parenthesis, | Pipe Line,) Closing Parenthesis,/Slash, - Minus Sign,? Question Mark, + Plus Sign,' Single Quotation, < Less than sign, " Double Quotation, [ Left Bracket, \ Backslash,] Right Bracket, ~ Tilde, { Open Brace, _ Underline.
C-Tokens
The smallest individual units of the program are tokens. There are six types of tokens. They are Keywords, identifiers, constants, strings, operators and special symbols.
Keywords
Keywords have a standard predefined meaning and they should be used only for their intended purpose. The keywords should be written in lower case.
Auto double int struct
Break else long switch
Case en-um register type-def
Char ex-tern return union
Const float short unsigned
continue for signed void
default goto size of volatile
do if static while
Identifier
These are the names given to the variables, functions, arrays and other user-defined objects. Identifiers are user-defined names.
Rules
a) Identifiers may be alphabets, digits and special characters with an underscore.
b) The first character must be alphabet
c) No special characters are allowed.
Example:
TOTAL_SCALE, B1, B15
Constants
The quantity whose value does not change during the program execution is called as constants. There are three types of constants.
1) Numeric constants
2) Character constants
3) String constants
1. Numeric constants
It is made up of digits and some special characters. They are divided into integer and floating-point.
Integer- It is made up of digits without a decimal point. The value ranges from -32,708 to +32,627.
Integer constant Range
Long integer 2,147,483,648 to 2,147,483,647
Short integer -128 to 127
Unsigned integer 0 to 65,535
Real constant-A number with one decimal point is called real constant. The real constant can be expressed in one of the two forms
a) Fractional form- a number with one decimal point eg-0.52
b) Exponent form- It is used to represent very large and very small real constants.eg-0.251E-5
Character constants
There are two types of character constant
1) Direct
2) Escape sequence
Direct
A single character is enclosed within single quotation marks. Eg-‘A’
Escape sequence
More than one character begins with a single quotation mark. The first character must be (/).
Character for Bell (Alert) '\a'. Character for Backspace '\b'.
Character for Horizontal Tab '\t'. Character for Vertical Tab '\v'.
Character for Newline (Line Feed) '\n'. Character for Form Feed '\f'.
Character for Carriage Return '\r'. Character for Quotation Mark '\"'.
Character for Apostrophe '\''. Character for Question Mark '\?'.
Character for Backslash '\\'. Character for Null '\0'.
Character for Bell (Alert) '\a'. Character for Backspace '\b'.
Character for Horizontal Tab '\t'. Character for Vertical Tab '\v'.
String constant
A sequence of characters enclosed in double-quotes. It can be digits, alphabets, special characters.
Example
“CHICAGO”
“12345”
Variables
A variable is a name given to the memory location to store data. A variable is a quantity whose value changes during the execution of the program.
Rules
a) A variable is formed with alphabets, digits and special characters.
b) The first character must be an alphabet.
c) No special characters are included
d) Variable used should be reserved word.
Example:
volume,t1,a0.
The Types of variables
1) Integer
2) Long integer
3) Short integer
4) Unsigned integer
5) Floating pint
6) Double
7) Character
8) Signed character
9) Unsigned character
10) String
Data types
The basic data types used in C are
Keyword No.of bytes Range
char 1 byte -128 to 127
int 2 bytes -32768 to +32767
float 4 byte 3.4 e-38 to 3.4 e+38
double 8 byte 1.7 e-308 to 1.7 +308
Operators:
An operator is a symbol that represents some operation that can be performed on data. The various types of operators are
Arithmetic operator
Operator Description Name Example
a + b Addition X=3 + 5 Adds the two operands
a - b Subtraction X=3 - 5 Subtracts the second operand from the first Operand.
a * b Multiplication X=3 * 5 Multiply both the operands.
a / b Division X=15 /3 Divides the first operand by the second.
a % b Modulo Division X=3 % 2 Returns the remainder after
Relational operators
These are used to find out the relationship between two operands
Operator Operation Example
> Grater than A>B
< Less than A
>= Greater than equal to A>=B
<= Less than equal to A<=B
== Equal to A==B
!= Not equal to A!=B
Logical operators
Logical operators are used to finding out the relationship between two or more relationship expressions.
Operator Meaning
&& AND
|| OR
! NOT
Increment and decrements operators
There are two special operators in C to control the loops in an effective manner. They are increments and decrements operators.
a) Increment operator – It is used to add 1 to the value contained in the variable. Eg- a++ which means a=a+1
b) Decrements operator- It is used to subtract 1 from the value contained in the variable. Eg- a—which means a=a-1
Conditional Operator
It is used to build some conditional expression. It has three operators hence it is called a ternary operator.
Expression1? expression2: expression3;
Example
Big=a>b?a:b;
a>b is tested first and if it is true big=a else big=b
Assignment operator
It is used to assign values to variables. The assignment operator is used.
Variable =constant
Example
X=10
Bitwise operator
The bit by bit operation is performed.
Operator Meaning
& Bitwise AND
| Bitwise OR
^ Bitwise exclusive OR
>> Bitwise right shift
<< Bitwise left shift
~ Bitwise complement
Sizeof operator
This operator is used to find the number of bytes occupied by the operand. The general form is
Variable=sizeof (operand);
Type Casting
It is the process of converting one data type into another. The two types of conversion are
1) Explicit conversion
The process of converting one data type into another explicitly using the cast operator.
new type(variable or expression);
2) Implicit conversion
The operands with lower data type operands are automatically converted into higher data types. This type of conversion is called implicit conversion.
Variable declaration:
The variables must be declared before we use it. Using the declaration we can declare the variables. The general form is
data-type variable list;
Example:
int a,b,c;
Elements of C Language Assignment Help
Initializing variables
The process of assigning initial values to the variables is called initializing variables. The variables can be initialized at the time of the declaration. The general form is
data-type variable =value;
Example:
int a=100;
Formatted and unformatted output functions
Input-output functions are used to transfer information between the computer and the input-output device. The input and output functions are carried out using the input-output function calls.
Formatted input function
Scanf()
It is used to give data to the variables using the keyboard. The general form is
Scanf(“control string’,&variable1, &variable2 ....& variable)
&- ampersand symbol before each variable is called as address operator.
Example:
Scanf(“%”,&a)
Formatted output function
Printf()
It is used to output the results of the program to the user. The general form is
print(“control string”,list);
Example:
Printf(“%d”,x);
Elements of C Language Assignment Help