Free Essay

# C Operators

Submitted By sanjuroshu
Words 462
Pages 2
C- Operators: 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: 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 A + B will give 30 A - B will give -10 A * B will give 200 B / A will give 2 B % A will give 0 A++ will give 11

+

-

Subtracts second operand from the first

*

Multiply both operands

/

Divide numerator by de-numerator

%

Modulus Operator and remainder of after an integer division Increment operator increases integer value by one 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 Checks if the value of two operands is equal or not, if yes then condition becomes true. Checks if the value of two operands is equal or not, if values are not equal then condition becomes true. Example (A == B) is not 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. Checks if the value of left operand is less than the value of right operand, if yes then condition becomes 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. 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 not true.

<

(A < B) is true.

>=

(A >= B) is not true.

postfix ++ and postfix –– prefix ++ and prefix –– sizeof & typecasts * + / – >> = % * +–~!

Left to right

Unary

Right to left

Unary Multiplicative Additive Bitwise shift Relational Equality Bitwise-AND Bitwiseexclusive-OR

Right to left Left to right Left to right Left to right Left to right Left to right Left to right Left to right

|

Bitwiseinclusive-OR

Left to right

&& ||

Logical-AND Logical-OR

Left to right Left to right

?:

Conditionalexpression

Right to left

= *= += ^= ,

/= |=

%= = &=

Simple and compound assignment2 Sequential evaluation

Right to left

–=

Left to right

Operators are listed in descending order of precedence. If several operators appear on the same line or in a group, they have equal precedence. All simple and compound-assignment operators have equal precedence. Compilers: A compiler is a program that translates a source program written in some highlevel programming language into machine code for some computer architecture. The generated machine code can be later executed many times against different data each time.

### Similar Documents

Free Essay

#### Cpu Tech

...Chapter 6 | Question 1 | | 1 / 1 point | A loop controlled by the user is a type of ____ loop. Question options: | indefinite | | definite | | counter-controlled | | incrementing | Question 2 | | 1 / 1 point | You use a unary minus sign preceding a value to make the value ____. Question options: | negative | | positive | | valid | | constant | Question 3 | | 1 / 1 point | Before entering a loop, the first input, or ____, is retrieved. Question options: | empty body | | posttest loop | | loop body | | priming read | Question 4 | | 0 / 1 point | Which is an infinite loop? Question options: | loopCount = 5; while(loopCount > 3); { System.out.println("Hello"); loopCount = loopCount - 1; } | | loopCount = 1; while(loopCount < 3); { System.out.println("Hello"); } | | loopCount = 4; while(loopCount < 3); { System.out.println("Hello"); loopCount = loopCount + 1; } | | loopCount = 1; while(loopCount < 3); { System.out.println("Hello"); loopCount = loopCount + 1; } | Question 5 | | 1 / 1 point | Use a(n) ____ loop to execute a body of statements continually as long as the Boolean expression that controls entry into the loop continues to be true. Question options: | empty | | while | | definite | | control | Question 6 | | 1 / 1 point | Making a comparison to 0 is slower than making a comparison to any other value. Question options: | True | | False | ......

Words: 873 - Pages: 4

Free Essay

#### Marketing

...Plan: Shorol Tariff | Particulars | TK/min | Outgoing | 24 hours | To Robi (incl. FnF ) | 0.68 | To Priyo (Partner) only Robi no. | 0.25 | SMS to Priyo (Partner) | 0.25 | To Other Operators (Incl. FnF) | 0.68 | To BTCL (Local/NWD) | 0.68 | To International (ISD)* | Only ISD Charges | Incoming | From any number worldwide | Free | Pulse | Outgoing | 60 sec from 1st minute*For ISD-15 sec pulse | NOBANNO Tariff | Particulars | Paisa/10s | Outgoing | 24 hours | To Robi (incl. FnF & priyo) | 14 | To Other Operators (Incl. FnF) | 14 | To BTCL (Local/NWD) | 14 | To International (ISD)* | Only ISD Charges | Incoming | From any number worldwide | Free | Pulse | Outgoing | 10 sec *For ISD-15 sec pulse | GOTI Tariff | Particulars | Paisa/10sec | Outgoing | 24 hours | To Robi (incl. FnF & priyo) | 18 | To Other Operators (Incl. FnF) | 18 | To BTCL (Local/NWD) | 18 | To International (ISD)* | Only ISD Charges | Incoming | From any number worldwide | Free | Pulse | Outgoing | 10 sec *For ISD-15 sec pulse | Robi Club |   | Tk./min |   |   | Outgoing | 12am - 6pm | 6pm - 12am | | 1st min | 2nd min & onwards | From 1st min | To Robi (incl. Priyo & FnF) | 1.00 | 0.25 | 1.00 | To Other Operators (incl. FnF) | 1.00 | 1.00 | 1.00 | To BTCL (Local/NWD) | 1.00 | 1.00 | 1.00 | To International (ISD)* | Only ISD Charges | Incoming | From any number worldwide | Free | ......

Words: 622 - Pages: 3

Free Essay

#### Matlab & Ss

...language itself bears some similarities with ANSI C and FORTRAN. MATLAB works with three types of windows on your computer screen. These are the Command window, the Figure window and the Editor window. The Figure window only pops up whenever you plot something. The Editor window is used for writing and editing MATLAB programs (called M-files) and can be invoked in Windows from the pull-down menu after selecting File | New | M-file. In UNIX, the Editor window pops up when you type in the command window: edit filename (‘filename’ is the name of the file you want to create). The command window is the main window in which you communicate with the MATLAB interpreter. The MATLAB interpreter displays a command >> indicating that it is ready to accept commands from you. • View the MATLAB introduction by typing >> intro at the MATLAB prompt. This short introduction will demonstrate some basic MATLAB commands. • Explore MATLAB’s help capability by trying the following: >> help >> help plot >> help ops >> help arith • Type demo and explore some of the demos of MATLAB commands. • You can use the command window as a calculator, or you can use it to call other MATLAB programs (M-files). Say you want to evaluate the expression [pic], where a=1.2, b=2.3, c=4.5 and d=4. Then in the command window, type: >> a = 1.2; >> b=2.3; >> c=4.5; >> d=4; >> a^3 + sqrt(b*d) - 4*c ans = -13.2388 ......

Words: 2151 - Pages: 9

Free Essay

#### Teamwork

...Journal of Arti cial Intelligence Research 7 (1997) 83-124 Submitted 6/97; published 9/97 Towards Flexible Teamwork Milind Tambe Information Sciences Institute and Computer Science Department University of Southern California 4676 Admiralty Way Marina del Rey, CA 90292, USA tambe@isi.edu Many AI researchers are today striving to build agent teams for complex, dynamic multi-agent domains, with intended applications in arenas such as education, training, entertainment, information integration, and collective robotics. Unfortunately, uncertainties in these complex, dynamic domains obstruct coherent teamwork. In particular, team members often encounter di ering, incomplete, and possibly inconsistent views of their environment. Furthermore, team members can unexpectedly fail in ful lling responsibilities or discover unexpected opportunities. Highly exible coordination and communication is key in addressing such uncertainties. Simply tting individual agents with precomputed coordination plans will not do, for their in exibility can cause severe failures in teamwork, and their domain-speci city hinders reusability. Our central hypothesis is that the key to such exibility and reusability is providing agents with general models of teamwork. Agents exploit such models to autonomously reason about coordination and communication, providing requisite exibility. Furthermore, the models enable reuse across domains, both saving implementation e ort and enforcing consistency. This...

Words: 12534 - Pages: 51

#### Welco Lumber Case Analysis

...true sample size of only 362 logs, as data for logs # 30, 123, and 127 are missing from his report. He videotaped 3 operators, April, Sid, and Jim, marking the logs, how each log was broken down and the degree to which the cants were properly centered. Gene then did a comparison of what the cost was of the log in its current condition (actual value), to what would have been the correct value of the log if the cut had been accurate (potential value). This allowed him to see the potential revenue that Welco Lumber Company is losing out on their business (profit gain). Question 1: How much profit is lost on imperfect board cuts? During the processing of 362 logs, it was found that exactly half (181) or fifty percent were processed without error. The remaining 181 logs were found to have undergone some type of error in the breakdown process—excessive log breakdown, off center cant, reduced value cut. As a result, the Welco Lumber Company missed out on \$735.14 in potential profit. Taking these results one step further, the potential amount of money lost on each of the 181 logs with errors was broken down into ranges of value lost as shown below. From the graph we can see the nominal value that was lost the most fell between the \$1.51 to \$4.50 ranges. Question 2: How does performance vary among operators? Below is a table that shows the analysis of each operator by log size, log volume, and with the monetary values of actual versus potential values. We can see that April......

Words: 663 - Pages: 3

Free Essay

#### Productivity Analysis Example

...INSTITUT TEKNOLOGI BANDUNG 2015 CASE: Construct a cycle chart, a process chart, and a crew balance chart for a pile-driving operation. Then show the improved productivity and LUF. I. PROJECT Project Resource Step 1 : Pile-driving operation : 3 (three) Time (mins) Rigger 1 00.00 - 02.00 connects pile to the sling Rigger 2 Pile-driver connects pile to the sling waits 02.00 - 04.00 assists pile-driver operator waits 3 04.00 - 05.00 assists in spotting the pile tip waits positions location and angle of pile 4 05.00 - 09.00 waits waits pounds the pile into the ground 5 EXISTING CONDITION 2 swings over to the pile, connects its hoist table to the sling, and hoists the pile into its leads takes continous measurements 09.00 - 10.00 of the pile length remaining counts blows above the grade Project Resource Step pounds the pile into the ground : Pile-driving operation : 3 (three) Time (mins) Rigger 1 Rigger 2 Pile-driver SIKLUS 1 00.00 - 02.00 connects pile to the sling connects pile to the sling waits 2 02.00 - 04.00 assists pile-driver operator waits swings over to the pile, connects its hoist table to the sling, and hoists the pile into its leads 3 POTENTIAL IMPROVEMENT 1 04.00 - 05.00 assists in spotting the pile tip waits positions location and angle of pile 4 05.00 - 07.00 waits waits pounds the pile into the ground 5 07.00 - 09.00 connects pile to the sling connects pile to the sling pounds the pile into the ground 6 takes......

Words: 998 - Pages: 4

Free Essay

#### Curl and Div

...F1 , F2 , F3 > : R3 → R3 be a diﬀerentiable vector ﬁeld. The divergence of F is the scalar function div F = and the curl of F is the vector ﬁeld curl F = ∂F3 ∂F2 − ∂y ∂z i+ ∂F1 ∂F3 − ∂z ∂x j+ ∂F2 ∂F1 − ∂x ∂y k ∂F1 ∂F2 ∂F3 + + . ∂x ∂y ∂z Note that the divergence can be deﬁned for any vector ﬁeld F : Rn → Rn , while the curl is only deﬁned on vector ﬁelds in 3-space. There is a nice second way to deal with these functions. Deﬁne the operator , called the “del” operator, by = ∂ ∂ ∂ i+ j+ k= ∂x ∂y ∂z ∂ ∂ ∂ , , ∂x ∂y ∂z The action of the del operator on a scalar function f : R3 → R is just the gradient: f= ∂f ∂f ∂f i+ j+ k= ∂x ∂y ∂z ∂f ∂f ∂f , , ∂x ∂y ∂z = grad(f ) The divergence and the curl of a vector ﬁeld are given by the two vector products that we have: the curl is the dot product and the curl is the cross product. div(F) = ·F curl(F ) = × F. Theorem 1 Let f be a diﬀerentiable scalar function and F be a diﬀerentiable vector ﬁeld on R3 . 1. curl(grad f ) = 0 or 2. div(curl F) = 0 or × ( f ) = 0. ·( × F) = 0. The Laplacian operator on a scalar function is deﬁned to be f = div(grad f ) = 1 · f= 2 f. The Laplacian of a vector ﬁeld F is F= F1 , F2 , F3 . Geometrically, the curl F is a measurment of the tendency of a ﬂuid to swirl around an axis. A ﬁeld F with curl F = 0 at a point P is called irrotational at P . The divergence of a vector ﬁeld measures the incompressibility of a vector ﬁeld and we can often interpret the divergence of a...

Words: 969 - Pages: 4

#### Earth Buddy

...three shifts a day, seven days a week? Which operation is the bottleneck? TASK | TIME | NUMBER OF OPERATORS | a.BUDDIES/HR | b.BUDDIES/SHIFT | c.BUDDIES/ "2" SHIFTS | d.BUDDIES/ "3" SHIFTS | e.BUDDIES/ "3" SHIFTS - 7 DAYS | FILLING | 1.5 | 6 | 240 | 1680 | 3360 | 5040 | 35280 | MOULDING | 1.6 | 3 | 225 | 1575 | 3150 | 4725 | 33075 | EYES | 1.2 | 2 | 300 | 2100 | 4200 | 6300 | 44100 | EYE GLASS | 1.2 | 1 | 300 | 2100 | 4200 | 6300 | 44100 | PAINTING | 1.5 | 1 | 240 | 1680 | 3360 | 5040 | 35280 | PACKING | 1.98 | 2 | 363 | 2541 | 5082 | 7623 | 53361 | a. Buddies/hr =          60minutes x Operators                                  time/task b. Buddies/shift =      60minutes x Operators x Productive hrs                                  time/task  c. Buddies/ 2 shifts = 60minutes x Operators x Productive hrs x No. Of Shifts                                  time/task d. Buddies/ 3 shifts = 60minutes x Operators x Productive hrs x No. Of Shifts                                  time/task e. Buddies/ 3 shifts = 60minutes x Operators x Productive hrs x No. Of Shifts x Days     7 Days                   time/task Bottleneck = Lowest output (Moulding) Theoretical Capacity/hr = Operators x         60min                                                          Total time/task 15 x   60     =     258/hr         3.48    Q2. If all of the operators work at the rates Ben observed, and assuming that there are sufficient input materials......

Words: 991 - Pages: 4

Free Essay

#### No Idea

Words: 385 - Pages: 2

#### Lesson 5

...2. How do you form a simple condition? SELECT STUDENT_ID FROM STUDENT WHERE STUDENT_NUMB = ‘000843’; 3. How do you form a compound condition? By connecting two or more simple conditions with the AND, OR, and NOT operators 9. How do you sort data? You can sort data by using the ORDER BY operator. 12. What are the SQL aggregate functions? The SQL aggregate function are functions used to calculate sums, averages, counts, maximum values, and minimum values. 14. What is a subquery? When a query is inside of another query the inner query is the subquery. 15. How do you group data in an SQL query? You can group SQL query data by using the GROUP BY clause on a particular object. 16. When grouping data in a query, how do you restrict the output to only those groups satisfying some condition? By using the HAVING clause a query can be written to display the groups that are included Also complete the following Exercises using the Premier Products database on page 132: 3. List the names of customers with credit limits of \$10,000 or more. 5. List the number and name of each customer represented by sales rep 35 or sales rep 65. 8 List the part number, part description, and on-hand value (units on hand * unit price) of each part in item class SG.(On-hand value is really units on hand * cost, but there is no COST col- umn in the PART table.) Assign the name ON_HAND_VALUE to the computed column. 9. List the part number, part description,...

Words: 327 - Pages: 2

#### Case Study Arc Solutions Provides a Centrally Controlled Operator Center Solution to Heffernan Group

...Case Study Arc Solutions Provides a centrally controlled operator center solution to Heffernan Group s o l u t i o n s The Challenges With an overall emphasis on customer service excellence, communication both internally and with customers has always been a key element to the success of the company. Whilst effective, this solution was not ideal as the company’s main aim was to ensure that all customers were dealt with personally by the operators. Having separate telephone systems serving each site also provided challenges, with the infrastructure being inflexible and a high systems management overhead. It also meant that operators had to be deployed to cope with the incoming traffic of that particular branch office, with no capability to share the load with other offices in busier times. Heffernan therefore decided to move to a single centralized communications platform, serving all sites. They chose Cisco Unified Communications technology as it delivered the power, flexibility and reliability to serve the whole business and its customers, both now and in the future. Whilst this provided an excellent platform for unifying communications across the enterprise, Profile Heffernan Insurance Brokers, formed in 1988, is one of the largest independent insurance brokerage firms in the United States. Heffernan provides comprehensive insurance and financial services products to a wide range of businesses and individuals. Headquartered in Walnut Creek, California, Heffernan......

Words: 978 - Pages: 4

Free Essay

#### Prelab Assignment Lab 5

...ITCS 1212L PreLab 5 Rational and equality operators, logical operators, conditional operators, conditional structures, selective structures, typecasting, and working with debuggers. Learning Objectives: ● Practice more with if-else-if and switch statements. ● Understand the concept of scope ● Understand the difference between static, local and global variables ● Practice with functions that can return more than a value and whose parameters’ scopes are not local to the function ● Input validation These pre-labs are directly related to the lab activities. You don’t need to complete the program. What you need to do is to work on the logic and perhaps some key parts of each program and then complete them in the lab. Assigned: Date of your lab 4 Due: the night before lab 5 Questions Prelab activity for Lab 5A: Find the difference between two types of returning values. Implement the following function prototypes (which take hours of work as integer and the rate of pay as float and calculates the net-payment as float) on paper. Also, write a main function which calls both functions. Compare the calculated net values and show the proper message whether or not they match. Name your variables as hours, rate, and netPay. float calNetPay(int, float); void calNetPay2(float&, int, float); Also, answer the following questions: What does the operator & do? Create a table and put all of the variables of the program inside the first column. The second......

Words: 471 - Pages: 2

Free Essay

#### Aircraft Systems and Aircraft Maintenance

...Name: Ramiro Rivera Date: 31 August 2013 Module 3 Aircraft Systems and Aircraft Maintenance LOB 8: Explain how an operator can fly an aircraft with inoperable instruments or equipment within the limits of an approved minimum equipment list (MEL). Web Support link: http://www.nbaa.org/ops/maint/inoperative-equipment/minimum-equipment-list.php Inoperable Equipment and Minimum Equipment List I have chose to use NBAA.org as a good resourceful tool for learning in general when it comes to aviation. This web link will teach you an easy and simple way the definition and use of a MEL. Definition of MEL: A Minimum Equipment List (MEL) is one method aircraft operators may use to obtain relief from Federal Aviation Regulations that generally require that all equipment installed on the aircraft be operative at the time of flight. A MEL is a precise listing of instruments, equipment and procedures that allows an aircraft to be operated under specific conditions with inoperative equipment. It will explain you step by step the procedure and use of an MEL, such as: * Obtaining FAA approval * Conducting operations with an MEL * Correcting MEL inoperative items * Record keeping requirements NBAA.org is an excellent website for any professional in aviation or for anyone interest in aviation. Using this beside you can find information from student material, airport operations, security, maintenance, job search and much more. As a professional pilot...

Words: 272 - Pages: 2

Free Essay

#### Programming Final

...Programming Final 1. The case structure lets the value of a variable or an expression determine which path of execution the program will take. It’s a multiple alternative decision structure that allows you to test the value of a variable or an expression and then use that value to determin which statement to execute. 2. The AND operator takes two Boolean expressions as operands and creates a compound Boolean expression that is true only when both expressions are true. True AND True = True 3. The OR operator takes two Boolean expressions as operands and creates a compound Boolean expression that is true when either of the sub expressions is true. True OR False = True 4. The NOT operator is a unary operator that takes a Boolean expression as its operand an reverses its logical value. The Not operator reverses the truth of its operand. If it is applied to an expression that is true the operator returns false. If it is applied to an expression that is false it returns True. Not true = False, Not false = True 5. Flow chart 6. And, Or , Not 7. And, Or, Not 8. And, OR, Not 9. > greater than, < less than, >= greater than or equal to, <= less than or equal to, == equal to, != not equal to 10. Case structure has a diamond at the top and branches down into different parallelograms. 11. A repetition structure causes a statement or set of statements to execute repeatedly. 12. A condition-controlled loop uses a true/false condition to control the number of times......

Words: 991 - Pages: 4