Escolar Documentos
Profissional Documentos
Cultura Documentos
ON
C-PROGRAMMING Day-1 Introduction to
By: S.S.Sadat, Lect Malik Sandal Polytechnic Bijapur
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
Introduction to C Programming
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 3
Agenda
1.0 Programming Language 2.0 Program Development Steps 3.0 History & Introduction to C 4.0 Basics Environment of C 5.0 Simple C Program 6.0 Characters and Tokens 7.0 Input/output in C
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 4
12/10/2013
12/10/2013
Types of Language
Third Generation
Second Generation
First Generation
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
First Generation
Machine language Natural language of a particular computer Consists of strings of numbers(1s, 0s) Instruct computer to perform elementary operations one at a time Machine dependant
Strings of numbers giving machine specific instructions
The only language the computer can understand is machine language (binary language).
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 7
Second Generation
Assembly language English like abbreviations Translators programs called Assemblers to convert assembly language programs to machine language. E.g. add overtime to base pay and store result in gross pay LOAD ADD BASEPAY OVERPAY
STORE GROSSPAY
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 8
Third Generation
High-level programming languages To speed up programming even further Single statements for accomplishing substantial tasks Translator programs called Compilers to convert highlevel programs into machine language E.g. add overtime to base pay and store result in gross pay grossPay = basePay + overtimePay A high level language is an English like language where one instruction typically translates into a series of machine-language instructions.
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 9
Fifth Generation
languages used for artificial intelligence and neural networks
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
10
12/10/2013
11
Convert
Compiler : Coverts the entire source program at a time into object code file, and saves it in secondary storage permanently. Interpreter : Each statement of source program is translated into machine code and executed immediately. Translation is repeated for every execution of the source program.
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
12
1 2 3 4 5 6 7 8 9 1 0
#include<stdio.h> int main(void) { int n1, n2,product; printf(Enter two numbers : ); scanf(%d %d,&n1,&n2); product = n1 * n2; printf(%d,product); return 0; } 12/10/2013
A low level language corresponds closely to machine code so that a single low-level language instruction translates to a single machine language instruction.
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
13
FORTRAN FoxPro HDML HTML Java JavaScript JCL LISP Live Script LOGO Pascal Perl PHP Pick Python
Prolog Ruby SGML Smalltalk SQL Tcl True BASIC VHDL Visual Basic Visual FoxPro WML WHTML XML
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
14
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
Algorithms
Step by step procedure designed to perform an operation, and which (like a map or flowchart) will lead to the sought result if followed correctly. Algorithms have a definite beginning and a definite end, and a finite number of steps. An algorithm produces the same output information as given the same input information, and several short algorithms can be combined to perform complex tasks . The word algorithm comes from the name of a Persian author, Abu Jafar Mohammed ibn Musa al Khowarizmi (c. 825 A.D.), who wrote a textbook on mathematics.
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 16
Flow Chart
A flowchart is a type of diagram that represents an algorithm or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows.
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
17
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
18
Loops
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
19
Terminal
Input/output Process Hard copy Decision Connector
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
Area of rectangle
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
21
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
22
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
23
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
24
BCPL (Basic Combined Programming Language) used for writing OS & compilers B used for creating early versions of UNIX OS Both were typeless languages C language evolved from B (Dennis Ritchie Bell labs)
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
25
Introduction to C
C programming language is also a high-level programming language
developed by Dennis Ritchie at Bell Labs in 1972 from an almost unknown language named B. in 1978 the publication of The C Programming Language by Kernighan & Ritchie
Dennis M. Ritchie
"ANSI C"
In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or "ANSI C", was completed late 1988
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
27
Cborn in the Computer Science Research Department of Bell Labs in Murray Hill, S.S.Sadat Lect Malik Sandal Polytechnic
12/10/2013 Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 28
Why use C?
Mainly because it produces code that runs nearly as fast as code written in assembly language. Some examples of the use of C might be:
Operating Systems Language Compilers, Embedded systems Assemblers Text Editors Print Spoolers Device drivers ,Network Drivers Modern Programs Data Bases , graphics and computational geometry Language Interpreters Application programs & Utilities
Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 29
Mainly because of the portability that writing standard C programs can S.S.Sadat Lect Malik Sandal Polytechnic offer
12/10/2013
Development with C
Four stages
Editing: Writing the source code by using some editor Preprocessing or libraries: Already available routines compiling: translates or converts source to object code for a specific platform source code -> object code linking: resolves external references and produces the executable module
Portable programs will run on any machine but.. Note! Program correctness and robustness are most important than program efficiency
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
30
12/10/2013
Basics of C Environment
Phase 1
Editor
Disk
Program edited in Editor and stored on disk Preprocessor program processes the code Creates object code and stores on disk Links object code with libraries and stores on disk
32
Phase 2 Preprocessor
Disk
Phase 3
Compiler
Disk
Phase 4
12/10/2013
Linker
Disk
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
Basics of C Environment
Primary memory
Phase 5
Loader
Primary memory
Phase 6
CPU
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
33
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
34
Structure of a C program
#include <stdio.h>
Program statement
void main (void) { /* This is the beginning of the program */ int local_var; Local variable declaration local_var = 5; global_var = local_var + VALUE;
Variable definition
printf (Total sum is: %d\n, global_var); // Print out the result }
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 35
Simple C Program
Line 1: #include <stdio.h>
As part of compilation, the C compiler runs a program called the C preprocessor. The preprocessor is able to add and remove code from your source file. In this case, the directive #include tells the preprocessor to include code from the file stdio.h. This file contains declarations for functions that the program needs to use. A declaration for the printf function is in this file.
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
12/10/2013
36
Preprocessor Directives
The first thing to be checked by the compiler. Starts with #. Tell the compiler about specific options that it needs to be aware of during compilation. There are a few compiler directives. But only 2 of them will be discussed here.
#include <stdio.h>
Tell the compiler to include the file stdio.h during compilation Anything in the header file is considered a part of the program
#define VALUE 10
Tell the compiler to substitute the word VALUE with 10 during compilation
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 37
Simple C Program
Line 2: void main()
This statement declares the main function. A C program can contain many functions but must always have one main function. A function is a self-contained module of code that can accomplish some task. Functions are examined later. The "void" specifies the return type of main. In this case, nothing is returned to the operating system.
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 38
Simple C Program
Line 3: {
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
39
Simple C Program
Line 4: printf("Hello World \n");
Printf is a function from a standard C library that is used to print strings to the standard output, normally your screen. The compiler links code from these standard libraries to the code you have written to produce the final executable. The "\n" is a special format modifier that tells the printf to put a line feed at the end of the line. If there were another printf in this program, its string would print on the next line.
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 40
Simple C Program
Line 5: }
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
41
Numeric digits: 0 - 9 Lowercase/uppercase letters: a - z and A Z Special Symbols : ~ ! @ # $ % ^ & ( ) _ - + = | \ , - * + : ; <>,.?/ White Spaces : space , Horizontal tab, Vertical tab, New Line Form Feed.
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 43
Token
The smallest individual units of a C- program are called Tokens A token is a language element that can be used in forming higher level language constructs Equivalent to a word in English language Several types of tokens can be used to build a higher level C language construct such as expressions and statements
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
12/10/2013
44
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
45
Reserved Words
Key words : have a predefined meaning and these meanings cannot be changed. Have special meaning to the compiler, cannot be used as identifiers in program. Should be typed in lowercase. Example: const, double, int, main, void, while, for, else (etc..)
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
46
Example
Keywords auto
break
double
else
int
long
struct
switch
case
char const
enum
extern float
register
return short
typedef
union unsigned
continue
default do
12/10/2013
for
goto if
signed
sizeof static
void
volatile while
47
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
Data Types
int
float
Double
char
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
48
In addition, there are float, void, short, long, etc. Declaration: specifies the type of a variable.
Example: int local_var;
Constants(Literals)
Fixed values that do not change during execution of a program types of constants: Boolean constants : 0 ( false) and 1 (true)
Integer constants
Positive or negative whole numbers with no fractional part Example:
const int MAX_NUM = 10; const int MIN_NUM = -90;
Floating-point constants
Positive or negative decimal numbers with an integer part, a decimal point and a fractional part Example:
const double VAL = 0.5877e2; (stands for 0.5877 x 102)
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 50
Character constants
A character enclosed in a single quotation mark Example:
const char letter = n; const char number = 1; printf(%c, S); Output would be: S
Enumeration
Values are given as a list Example:
enum Language { Malay, English, Arabic };
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
51
String Literals
A sequence of any number of characters surrounded by double quotation marks. Example:
REFORMASI My name is Salman
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
52
Identifiers(variables)
Words used to represent certain program entities (program variables, function names, etc). Example:
int my_name;
my_name is an identifier used as a program variable
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
53
Variables in C
Variables contain values that must be kept during the completion of a program (storage) for future use. In C, a variable MUST be declared before it can be used. Variables can be declared at the start of any block code, but most are found at the start of each function (main inclusive) Local variables are created when the function is called and destroyed on return from that
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 54
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
56
A variable can be declared globally or locally. A globally declared variable can be accessed from all parts of the program. A locally declared variable can only be accessed from inside the function in which the variable is declared.
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
57
Punctuators (separators)
Symbols used to separate different parts of the C program. These punctuators include:
* + ( ) , - , ; : * #
Usage example:
void main (void) { int num = 10; printf (%i, num); }
Delimiters : Language Pattern of c-language uses special kind of symbols : (colon, used for labels) ; (semicolon terminates statement ) ( ) parameter list [ ] ( array declaration and subscript ), { } ( block statement ) # ( hash for preprocessor directive ) , (comma variable separator )
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
58
Operators
Tokens that result in some kind of computation or action when applied to variables or or other elements in an expression. Example of operators:
*+=-/
Usage example:
result = total1 + total2;
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
59
Comments
Explanations or annotations that are included in a program for documentation and clarification purpose. Completely ignored by the compiler during compilation and have no effect on program execution. Starts with /* and ends with */ Some compiler support comments starting with //
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 60
statement
A specification of an action to be taken by the computer as the program executes. In the previous example, there are 2 lines following variable declaration and variable definition that terminate with semicolon ;. global_var = local_var + VALUE; printf (Total sum is: %d\n, global_var); Each line is a statement.
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
61
Input/output statement
Used the read the data value scanf(%d %d%d,&a, &b &c); input function Output used to print the result Printf(The sum=%d, sum) ; output function
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
62
Assignment statement
Used to perform arithmetic expression sum=a+b+c; Control statement: used to control statement If(a>b) print(a is big); else print(b is big);
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 63
7.0 Input/output in C
C language consists of input and output statement in the form of input functions to read the data to be processed and output function to print the result. A C program consists of one or more functions that contain a group of statements which perform a specific task.
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
64
Basic Functions
A C program must at least have one function: the function main. We can create our own function or use the functions that has been created in the library, in which case we have to include the appropriate header file (example: stdio.h).
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
65
In addition to those functions, we will also learn about Format Specifier and Escape Sequence which are used with printf() and scanf().
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
66
printf()
Used to send data to the standard output (usually the monitor) to be printed according to specific format. General format:
printf(control string, variables);
Control string is a combination of text, format specifier and escape sequence. Example:
printf(Thank you); printf (Total sum is: %d\n, global_var);
%d is a format specifier \n is an escape sequence
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 67
Tells the printf() function the format of the output to be printed put. S.S.Sadat Lect Malik Sandal Polytechnic
12/10/2013 Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 68
Code
\b \f \n \r \t \" \' \\ \v \a \? \N \xN
12/10/2013
Meaning
Backspace Form feed New line Carriage return Horizontal tab Double quote Single quote Backslash Vertical tab Alert Question mark Octal constant (N is an octal constant) Hexadecimal constant (N is a hexadecimal constant)
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 70
scanf()
Read data from the standard input device (usually keyboard) and store it in a variable. General format:
scanf(Control string, &variable);
The general format is pretty much the same as printf() except that it passes the address of the variable (notice the & sign) instead of the variable itself to the second function argument. Example:
int age; printf(Enter your age: ); scanf(%d, &age);
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 72
void main(void) { char my_char; printf(Please type a character: ); my_char = getchar(); printf(\nYou have typed this character: ); putchar(my_char); }
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 73
Minimal Range 127 to 127 0 to 255 127 to 127 32,767 to 32,767 0 to 65,535 Same as int 32,767 to 32,767 0 to 65,535 Same as short int 2,147,483,647 to 2,147,483,647 (263) to 263 1 (Added by C99) Same as long int 0 to 4,294,967,295 264 1 (Added by C99) 3.4e-38 to 3.4e+38 1.7e-308 to 1.7e+308 3.4e-4932 to 1.1e+4932 data type that not return any value
74
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
8.0 Arithmetic in C
C op era tion Addition Subtraction Multiplication Division Modulus Arithmetic op era tor + * / % Algeb ra ic exp ression f+7 pc bm x/y r mod s C exp ression f p b x r + * / % 7 c m y s
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
75
Precedence order
Highest to lowest
Operator(s) () Operation(s) Parentheses Order of evaluation (precedence) Evaluated first. If the parentheses are nested, the expression in the innermost pair is evaluated first. If there are several pairs of parentheses on the same level (i.e., not nested), they are evaluated left to right. Multiplication,Divi Evaluated second. If there are several, they are sion, Modulus evaluated left to right. Addition Evaluated last. If there are several, they are Subtraction evaluated left to right.
*, /, or % + or -
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
76
Example
Algebra:
z = pr%q+w/x-y
C:
z = p * r % q + w / x y ;
Precedence: 1
12/10/2013
5
77
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
Example
Algebra:
a(b+c)+ c(d+e)
C:
a * ( b + c ) + c * ( d + e ) ;
1 2
Precedence:
5
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 78
Decision Making
Checking falsity or truth of a statement Equality operators have lower precedence than relational operators Relational operators have same precedence Both associate from left to right
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
79
Decision Making
Standard algebraic equality operator or relational operator
Equality Operators
= not =
Relational Operators
x is equal to y x is not equal to y x is greater than y x is less than y x is greater than or equal to y x is less than or equal to y
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
80
Assignment operators
Used to assign the RHS value to LHS variable = a=10; b=5; sum=a+b; += a+=b; is equivalent to a=a+b; -= c-=d: c=c-d; *= p*=d; p=p*d; /= d/=d; d=d/s; %= i%=j; i=i%j;
height = 8; length = 12; width = 10; volume = height * length * width; /* volume is now 960 */
12/10/2013 S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 81
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
82
return 0;
5 6 6
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
83
/* prefix operators */
#include<stdio.h> int main() { int a = 7, b = 12, c; c = b * (++a) + 5 * (++a); printf( a = %d, a); printf(\n b = %d,b); printf(\n c = %d,c); } Output: a=9 b = 12 c = 153 ( 12 * 9 + 5 * 9)
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org 84
12/10/2013
12/10/2013
12/10/2013
12/10/2013
S.S.Sadat Lect Malik Sandal Polytechnic Bijapur,Mobile No +91 9448179626, E-mail sssadat@secab.org
87