C language


Published on

C language

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

C language

  1. 1. 1 PreparedBy:Yasir AhmedKhan| email: yasirahmedkha@ymail.com cell:03337015014 C C is a programminglanguage developed at AT & T’s Bell Laboratories of USA in 1972 by Dennis Ritchie. C is a computerProgramminglanguage that means that you can use c to create lists of instruction for a computerto followcisone of thousandsof programminglanguages currently in use c has been around for several decades and has won widespread acceptation because it gives programmers maximum control and efficiency.Cisan easyto learnitisa bitmore cryptic initsstyle than some other languages, but get beyond that fairly quickly. FEATURES OF C LANGUAGE:  C is a case sensitive language  C is a collection of libraries  Libraries is a collection of Functions  Function is a collection of Statements  Statements is a collection of Collectors  C language can Support IDE “Integrated Development Envorment”  C language can support only Compiler Translators  A C file Must Be .cpp (C plus plus) C Keywords Keywords are the words whose meaning has already been explained to the C compiler (or in a broad sense to the computer). The keywords cannot be used as variable names because if we do so we are trying to assign a new meaning to the keyword, which is not allowed by the computer. Some C compilers allow you to construct variable names that exactly resemble the keywords. However, it would be safer not to mix up the variable names and the keywords. The keywords are also called ‘Reserved words’. IDE: IDE abbreviate as “Integrated development envorment”. It is a platform that we can type any c program, compile, execution and display of results. IDE is a programming envorment that typically consistof code editor, acompiler,adebugand graphical user interface (GUI). The IDE is May stay alone application or may be included as a part of computer program. IDE is and interface between user and computer that perform simultaneously. COMMON EXAMPLE: GW-Basic, Visual Basic, C Language etc
  2. 2. 2 PreparedBy:Yasir AhmedKhan| email: yasirahmedkha@ymail.com cell:03337015014 Q: Define Header Files? HEADER FILES: DEFINATION: Headerfile isa collectionof functionthatfoundindifferentlibraries.A headerfileisalwaysdefine inthe top of program and found in include directory. The header files are always assigned with sign of #. An every header file contains different functions like <math.h> library is containing of different mathematical functions. Q: How Many Files to generate a compiler after the execution of C Program? C FILES: There are four files to generate a compiler automatically 1. .Cpp 2. .Bak 3. .Obj 4. .Exe .CPP The .Cpp isa source file thatbasedona c programmingcode withoutthisfile we cannot maintain other files the extension of .cpp is recognize as c plus plus code .BAK The backup file isautomatically generated file that provide backup of source code suppose the source file isdeletedwe canuse backupfile asa source code butit necessarytorename the extensionof file as .cpp .OBJ The .obj is objectorientedfile thatcontain amachine code and store errors, values, and result oriented machine code without the object file the source program cannot entertain. .EXE (Executable File) The Executable file isrunwithoutanysupportof program sometimes it called compiled file so the .exe file is a powerful extension that execute computer programs and there is no need to install any computer program
  3. 3. 3 PreparedBy:Yasir AhmedKhan| email: yasirahmedkha@ymail.com cell:03337015014 Q: Define Gotoxy Statements? Goto xy statements: The goto xystatementisusedto set the cursor on the screen and display text on the particular column and row/line. There are 256 columns ( 0 to 255) and 25 rows (0 to 24). SYNTEX: goto xy (C,R); EXAMPLE: Gotoxy(10,10); Printf(“ YASIR “); Q: Define Goto Statements? GOTO STATEMENT: The goto statement is a branching statement that we can move the cursor in the particular line sometimes we can say it’s a conditional statement. SYNTEX: goto c; EXAMPLE: Char a=’B’; c: printf(“ HI”); getche(); goto c; BREAK STATEMENT: The break statement is used to terminate the nearest statement or do, for , switch-case and while statement. The break statement is also perform in loops it mean we can terminate in the mid of loop. SYNTEX: break; EXAMPLE: Int a; Printf(“1.Books Name”); Printf(“ 2. Exit “); Switch(no) { Case 1; Printf(“ C language “); Break; Default: Break; Printf(“Wrong Entry”); }
  4. 4. 4 PreparedBy:Yasir AhmedKhan| email: yasirahmedkha@ymail.com cell:03337015014 Q: Define Return Statements? RETURN STATEMENT: The return statement is used to terminate the execution of function and return to the calling of function. The return function is also used to return the value of calling of function. SYNTEX: return expression If no return statement found in function definition, the control automatically returns to the calling of function.If a returnvalue is not required, declare the function with the data type of void otherwise to return the integer data type. Q: Define Continue Statements? CONTINUE STATEMENT: The continue statement is used to pass the control of next iteration of the nearest do…while, and for and by pass the remaining statements in the do, for, and while statement of the body. SYNTEX: continue; The Continue statement is always perform when we cross of the body of the any loop and moves the cursor or pointer in the next statement. EXAMPLE: void main (void) { clrscr(); int a; for(a=1;a<=10;a++) { if(a==5) continue; printf("n %d",a); }
  5. 5. 5 PreparedBy:Yasir AhmedKhan| email: yasirahmedkha@ymail.com cell:03337015014 Q: Define Variable And Its Types? VARIABLES: A variable is a name of value that store unique value. A variable is a collection of characters normally in any language a variable can perform very important role that capable to store values. A variable can identify by their names like a,b,c,x,y,z RULES OF VARIABLES:  A Variable must be a character  We cannot define numeric number as a variable  We can assign variables as a character and numeric like A1,A2,A3  We can assign a variable 8 to 12 characters  Variable are not allowed to assign special symbols  Example a=10; b=’c’;  We Cannot allow duplicate values TYPES OF VARIABLES: 1. Constant Variable or String Value 2. Numeric Variable CONSTANT VARIABLES: A constant is a collection of characters and character may be A to Z, a to z.. 0 to 9, & $ The constant variable cannot change during the execution e.g b=’c’; z=55; NUMERIC VARIABLES: The numeric variable is use to store only numeric values e.g c=10(constant numeric value). The variable may be change during the execution of computer program.
  6. 6. 6 PreparedBy:Yasir AhmedKhan| email: yasirahmedkha@ymail.com cell:03337015014 Q: What Are Data Types? DATA TYPES: Data types are use to store which type of data stored in the variables. Data types are always identifying by their name, data types is a computer memory location that store data. Data types are always define in the beginning of computer program. There are various data types used in c language but major are, INTEGER DATA TYPE: Integer data type is use to store sure numeric value. Integer data type is capable to store - 32768 to 32767 and accommodate 4bytes SYNTEX: int a; CHARACTER DATA TYPE: Character data type is always store string value and occupies 2 bytes and store 0 to 255 at a time SYNTEX: char a[30]; FLOAT DATA TYPE: Float data type is used to store numeric value with decimal places. A floating data type always reserved 4 bytes with the range of 0 to 2.4e SYNTEX: float a=10.2;
  7. 7. 7 PreparedBy:Yasir AhmedKhan| email: yasirahmedkha@ymail.com cell:03337015014