Q..What is c tokens? explain few of them

Ans.. token  in c is the most important element to be used in creating a program in c. we can define the token as the smallest individual element in c. for example, we cannot create a sentence without using words, similarly we cannot create a program in c. without using tokens in c. therefore, we can say that token in c is the building block or the basic component for creating a program in c language.

#classification of tokens in c.

Tokens in c language be divided into the following categories.

  1. Keyword in c
  2. Identifiers in c
  3. String in c
  4. Operator in c
  5. Constant in c
  6. Special characters in c
  1. Keyword in c….

Keyword in c can be define as the predefined or the reserved words having its own importance, and each keyword use by the compiler so they cannot be used as the variable  name it mains that we are assigning a different meaning to the keyword, which is not allowed .keywords cannot use as an identifier.all keywords are basically a sequence of character that have a fixed meaning. c language supports 32 keyword given below.

  1. Identifiers in c….

Identifier in c used for naming variable, function, array, structures etc. identifier in c are the user defined word. It can be composed of uppercase letter, lowercase letter, underscore, or digits, but the starting letter should be either an underscore or an alphabet. Identifier cannot be used as keywords , rules for constructing identifier in c below.

  1.  Identifier only contain numbers letter lowercase and uppercase letter
  2.  Variable name only start with alphabet and  underscore but not use two successive underscores.
  3. Variable name never start with digits
  4. Identifier name are case sensitive. 
  5. Keywords cannot be used as identifier.

3. String in c….

String in c represented as an array of characters having null \0 at the end of the string in c are unclosed within double quotes, while characters are unclosed within single characters that  the string contains.

4. Operators in c….

Operator in c is a special symbol  used to perform the functions, the data item in which the operator are applied are know as operands operator are applied between the  operands . depending on the number of the operands.it is three types unary,binary and ternary.

And it has 10 categories..

5. Constant in c….

Constant are identifiers whose vale do note changed.while value is variable can be changed at any time ,values of constant can never be changed.constant are used to fixed value it is four type of constant integer type,floating point type,character type and string type

#there are two ways of declaring constant:

  1. Using const keyword 
  2. Using define preprocessor

6. Special characters in c….

Like in natural languages, computer language also use a character set that defines the fundamental units used to represent information.a special character in use is in also alphabet ,digits, symbol used to represent to all information.

Some rule its

  1. English alphabet to both upper case(A-Z) and lower case (a-z) lettrs.
  2. Include numerical digits(0-9).
  3. Include all symbol (~!,@.#,$,%,^,&,*,(,),_,+,{,},|,:,”,<,>,?,,,.,/,’,;,\,],[,=,-,`,).
  4. Space is the special character.
  5. White space include

       \b=blank space

      \t=Horizontal tab

      \v=vertical return

      \r=carriage return

      \f=Form feed

     \n=new line

6.Bitwise operators:As the name suggest bitwise operators are the those operators that perform operations at level .These operation include : bitwise AND ,bitwise OR bitwise XOR and shift operators.

A.bitwise AND:like boolean AND (&&) bitwise (&) performs operation on bits instead of bytes ,char,integers etc.it oprends is 1 bit.it similar to the AND logical operators .

Ex. 10101010 & 01010101=00000000

Int a =10 ,b=20,c=0;

c=a&b;

B. bitwise OR:when we use the bitwise OR operator (|),the bit in the first operand is OR ed with the corresponding bit in the second oprand.

Ex. 10101010 & 01010101 =11111111

Int a=10,b=20,c=0;

c=a|b

C. bitwise XOR:The bitwise XOR operators (^) performs operation on individual bits of the operands .the first operand is XORed with the corresponding bit in the second operand.it operand 1 bits.

Ex. 10101010 ^ 01010101=11111111

Int a=10,b=20,c=0;

c=a^b

D.shift operators:C supports two type of bitwise operators the are shift -left(<<) and shift-right (>>).These operations are simple and are responsible for shifting bits either to left or to the right.

Ex.  of bitewise operators a complete programe…….

#include<stdio.h>

Int main(){

Int aa=27,b=39;

printf(“a & b=%d\n”,a&b);//3

printf(“a | b=%d\n”,a|b);//63

printf(“-a=%d\n”,-a);//-28

printf(“- b=%d\n”,-b);//-40

printf(“a ^ b=%d\n”,a^b);//60

printf(“a <<1=%d\n”,a<<1);//54

printf(“b>>1=%d\n”,b>>1);//19

}

5,Unary operators:

Unary operators act on single operands. C language supports three  unary operators unary minus,increment,and decrement operators.

A.unary minus>>>Unary minus (-)operators is strikingly different from the binary arithmetic operator that operates on two operands and subtracts the second oprend from the first oprends.

The unary operators is sign negative value 

Ex: int a,b=10;

a=-(b)

         Here this is value is changed in negative value by minus operators

B.increment operator:The increment operator that increases the value of its operand by 1.

It sign (++).

Ex . int a,b=10;

       b++; //then b=11

c.Decrement operators:it is similar to decrement operator but it decreases the value by 1.

It sign (–).

Ex int a,b=10;

       b–;//then value is b =9

$it is two variant  

                    Prefix and postfix((pre increment and pre decrement)

Its sign(++x and –x).

Q.what is c programing ? Explain few them.. 

ans=C programing is a general purpose ,procedural,imperative computer programing language devolved in Dennis M. Rithie at the the Telephone Laboratories to develop the UNIX operating system . C is the most widely used computer language .It keeps fluctuating at number one scale of popularity along with Java programing language,which is also equally popular and most widely used modern software programs.

                                                                  C programing language is a MUST for student and working professionals to become a greet software Engineer specially when they working in Software development domain . 

$ some characteristic of c:

 1.Easy to learn 

2.Structured language

3.It produces efficient programs

4.It can handle low -level activities

5.It can be complied on a variety of computer platforms

$some fact in C language:

  1. C was invented to write an operating system called UNIX.
  2. C is a successor of B language which was introduced around the early 1970s.
  3. The language was formalized in 1988 by American national standard institute (ANSI).
  4. The UNIX OS was totally written in C.
  5. Today C is the most widely used and popular system programing language.

 //Hello world in c programing:

    *..the first program in c ,output hello world,below that:

#include<stdio.h>

//get standard input output

Int main(){

//is called main function and it is where the first code starts being run in a C program

//my first program in c

printf(“Hello world! \n”);

//is print display text in this case “Hello world”,with a new line (\n) at the end

return  0;

//did not computer in run time in problem

}

$ Application of C programing:

C was initially used for system development work ,particularly the programs that make-up the operating system C was adopted as a system development language because it produces code that runs nearly as fast as the code written in assembly language.

1.Operating system 

2.language compilers 

3.Assemblers

4.Text editors

5.Print spooleers 

6.Network drivers

7.Modern programs

8.Databases

9.Utilities

$ A c programe  basically consists of the following parts :

1.preprocessor commands

2.Function 

3.Variables 

4.Statement and Expressions

5.Comments

$C data type:

#there are three data type:

1.basic data type

2.derived data type:

3.user defined data type

1.basic data type:

A.integer data (int) it store integer value in 2 bytes to 4 bytes.

B. floating data(float) it store decimal number in 4 bytes.

C .character data(char) it store single character in 1 bytes.

D .double :it is used to store decimal number with double precision.

It store data 4 bytes to 8 bytes.

2.derived data type:

 A .Array:an array is stored is an ordered sequence of finite data items of the same data type that share a common name.

B .pointers:a pointers is special type of variable used to hold the address of another variable.

C .Function:A function is a block of code,it one or more statement pass in parameter that can work.

D.string:it store character array.

3.user defined data type :

1.structures:(struct) A structure is a collection of different data type items stored in a contiguous memory allocation.

2.Unions:(union) a union  is similar to the struct data type but it has large data type memory allocation

3.Enumeration:(enum) it store data type that consist of integral constant.      

Q.what is operator explain it Category?

Ans:an operators is symbol that specifies the mathematical,logical or relational operation to be performed.C language supports different types of operators ,which can be used with variables and constant to from expressions .

$these operators can be categorized into the following major groups:

1.arithmetic operators 

2 .relational operators 

3.Equality operators 

4.Logical operators

5. Unary operators 

6.Conditional operators 

7.Bitwise operators 

8.Assignment operators

9.Comma operators 

10.sizeof operators

Design a site like this with WordPress.com
Get started