- school Campus Bookshelves
- menu_book Bookshelves
- perm_media Learning Objects
- login Login
- how_to_reg Request Instructor Account
- hub Instructor Commons

## Margin Size

- Download Page (PDF)
- Download Full Book (PDF)
- Periodic Table
- Physics Constants
- Scientific Calculator
- Reference & Cite
- Tools expand_more
- Readability

selected template will load here

This action is not available.

## 1.1: Operators and Special Characters

- Last updated
- Save as PDF
- Page ID 86608

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\id}{\mathrm{id}}\)

\( \newcommand{\kernel}{\mathrm{null}\,}\)

\( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\)

\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\)

\( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)

\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)

\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vectorC}[1]{\textbf{#1}} \)

\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

Help Center Help Center

- Help Center
- Mises à jour du produit
- Documentation

## Operator Overloading

Why overload operators.

By implementing operators that are appropriate for your class, you can integrate objects of your class into the MATLAB ® language. For example, objects that contain numeric data can define arithmetic operations like + , * , - so that you can use these objects in arithmetic expressions. By implementing relational operators, you can use objects in conditional statements, like switch and if statements.

## How to Define Operators

You can implement MATLAB operators to work with objects of your class. To implement operators, define the associated class methods.

Each operator has an associated function (e.g., the + operator has an associated plus.m function). You can implement any operator by creating a class method with the appropriate name. This method can perform whatever steps are appropriate for the operation being implemented.

For a list of operators and associated function names, see MATLAB Operators and Associated Functions .

## Object Precedence in Operations

User-defined classes have a higher precedence than built-in classes. For example, suppose q is an object of class double and p is a user-defined class. Both of these expressions generate a call to the plus method in the user-define class, if it exists:

Whether this method can add objects of class double and the user-defined class depends on how you implement the method.

When p and q are objects of different classes, MATLAB applies the rules of precedence to determine which method to use.

For more information on how MATLAB determines which method to call, see Method Invocation .

## Operator Precedence

Overloaded operators retain the original MATLAB precedence for the operator. For information on operator precedence, see Operator Precedence .

## Sample Implementation — Addable Objects

The Adder class implements addition for objects of this class by defining a plus method. Adder defines addition of objects as the addition of the NumericData property values. The plus method constructs and returns an Adder object whose NumericData property value is the result of the addition.

The Adder class also implements the less than operator ( < ) by defining a lt method. The lt method returns a logical value after comparing the values in each object NumericData property.

Using a double converter enables you to add numeric values to Adder objects and to perform addition on objects of the class.

Add two objects:

Add an object with any value that can be cast to double:

Compare objects a and b using the < operator:

Ensure that your class provides any error checking required to implement your class design.

## MATLAB Operators and Associated Functions

The following table lists the function names for MATLAB operators. Implementing operators to work with arrays (scalar expansion, vectorized arithmetic operations, and so on), can also require modifying indexing and concatenation. Use the links in this table to find specific information on each function.

## Related Topics

- Define Arithmetic Operators
- Methods That Modify Default Behavior

## Commande MATLAB

Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :

Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

- Switzerland (English)
- Switzerland (Deutsch)
- Switzerland (Français)
- 中国 (English)

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

- América Latina (Español)
- Canada (English)
- United States (English)
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- United Kingdom (English)

## Asia Pacific

- Australia (English)
- India (English)
- New Zealand (English)

Contact your local office

- Testimonials

2020 All Rights Reserved By © Matlab Simulation

## Form Submitted

Www.matlabsimulation.com, matlab assignment operator, related pages.

Matlab Support

Matlab Services

Matlab Help Desk

Matlab Consultancy

Online Help Matlab

Matlab Code Helper

Online Matlab Experts

Matlab Online Support

Matlab Project Makers

Matlab Project Centers

Matlab Assignment Maker

Matlab College Projects

Matlab Assignment Help Uae

Matlab Assignment Help India

Matlab Assignment Help Malaysia

## Research Areas

Digital Image processing

Medical Image processing

Biomedical Signal processing

Biometric Detection

Information Security

Neural Networks

Network Security

Wireless Networks

Wireless Communication

Matlab Simulink

power Electronics

Renewable Energy

Mobile Communication

Satellite Communication

Optical Communication

Video processing

Artificial Intelligence

Advanced Robotics

## Related Tools

3D-2D CONVERTER

RAPID MINER

SENTI WORDNET

CLOUD REPORTS

Matlab Assignment Operator can give you the best assistance for your assignment. We serve students as per their requirements based on the latest trends. In general, we have nearly 100+ employees working on all the latest algorithms, datasets, and tools used in Matlab. We show our uniqueness through our codes; we develop simple codes to better understand students but provide quality output. Our experts continuously update the most important technical aspects and issues in order to feed the students with the best knowledge. Even we work on the most difficult application and a toolbox of Matlab with complete ease. Today millions of engineers and scientists are using Matlab worldwide to create something innovative.

## Why Matlab has evolved so fast can be the question for many, its answer lies in its major features like

- Matlab based languages are best way to express computational mathematics
- Built in graphics provides visualization of data
- Have tools for every major application
- Using Matlab, we can work on large datasets and scale up to clouds and clusters
- It can be easily integrated with other languages providing the ease to deploy algorithms and applications used in web, enterprise and various production systems.

To begin with our Matlab Assignment Operator , we first focus on the most basic requirement to perform Matlab assignment. To perform any Matlab assignment, we need to know about the Matlab versions and its support in the various OS. If we know the specific version and OS, it will make the installation and development process easy.

We want to guide our students with all the information about Matlab. Here we have mainly focused on Matlab versions and their support. We support Matlab assignment in all types of versions and platforms.

- First version-MAT-LAB 5.0
- Latest version- R2015b(32 bit) , R2016a (64 bit)

## Let’s Now See Each OS and Its Supported Version

- 32 bit – R2015a and R2015b
- 64 bit- R2015a, R2015b, R2016a, R2016b, R2017a, R2017b
- 32 bit – R2013a, R2013b, R2014a, R2014b, R2015a, and R2015b
- 64 bit- R2013a, R2013b, R2014a, R2014b, R2015a, R2015b, R2016a, R2016b
- 32 bit – R2013a, R2013b, R2014a, R2014b, R2015a and R2015b
- 32 bit – R2013a, R2013b, R2014a, R2014b, and R2015a
- 64 bit- R2013a, R2013b, R2014a, R2014b, R2015a

## For Linux Platform(64 Bits)

- Ubuntu 14.04 LTS- R2014b, R2015a, R2015b, R2016a, R2016b
- Ubuntu-12.04 LTS-R2013a, R2013b,R2014a
- Ubuntu 10.04 LTS-Supports prior versions only
- Red Hat Enterprise Linux 7- R2014b, R2015a, R2015b, R2016a, R2016b
- Red-Hat Enterprise Linux 6-R2013a, R2013b, R2014a,R2014b, R2015a, R2015b, R2016a, R2016b
- Red Hat Enterprise Linux 5-R2013a

## MAC OS X(64 Bits)

- Snow Leopard-
- EL Capitan- R2015b, R2016a, R2016b
- Yosemite- R2014b, R2015a, R2015b, R2016a, R2016b
- Mavericks- R2013a,R2013b, R2014a,R2014b, R2015a, R2015b
- Mountain Lion- R2013a,R2013b,R2014a,R2014b
- Lion- R2013a,2013b,R2014a,R2014b

Through the Matlab Assignment Operator , we support all types of assignments for our students. We work on all the Matlab simulation, computing, modeling, toolboxes, and concepts. It is completely based on students’ needs and requirements. Our support is a never-ending ocean; you can ask millions of assignments from us and expect the same quality work.

## A life is full of expensive thing ‘TRUST’ Our Promises

100% confidential.

We don’t disclose our client’s data to any third party and it is kept as secret to all.

## Fresh Ideas

All the time, you receive only the novel ideas that not release from anywhere.

## Work Guarantee

We guarantee for your satisfaction and it is not further need of correction and complaints.

## Plagiarism Free

We follow our own writing. It means that without copying from any source, we write it.

We are not intent to sale our product to more than one person. It is totally new for each.

## Business Ethics

Surely, we follow our set of ethics to send the high quality products for everyone.

## On-Time Delivery

We always deliver your work at the time of delivery. So that feels our timely guidance.

## Affordable Price

We are not serving with high cost. You get an excellent work in at reasonable price.

We meet each individual customer’s demands by our years of skills. This is the secret of success.

## Great Memories Our Achievements

We received great winning awards for our research awesomeness and it is the mark of our success stories. It shows our key strength and improvements in all research directions.

## Our Guidance

- Assignments
- Literature Survey
- Mathematical Proofs
- Research Proposal
- System Development
- Paper Writing
- Conference Paper
- Thesis Writing
- Dissertation Writing
- Hardware Integration
- Paper Publication

## 24/7 Support, Call Us @ Any Time [email protected] +91 94448 56435

Help Center Help Center

- Help Center
- Trial Software
- Product Updates
- Documentation

## Comma-Separated Lists

What is a comma-separated list.

When you type in a series of numbers separated by commas, MATLAB ® creates a comma-separated list and returns each value individually.

When used with large and more complex data structures like MATLAB structures and cell arrays, comma-separated lists can help simplify your code.

## Generating a Comma-Separated List

You can generate a comma-separated list from either a cell array or a MATLAB structure.

## Generating a List from a Cell Array

When you extract multiple elements from a cell array, the result is a comma-separated list. Define a 4-by-6 cell array.

Extract the fifth column to generate a comma-separated list.

This is the same as explicitly typing the list.

## Generating a List from a Structure

When you extract a field of a structure array across one of its dimensions, the result is a comma-separated list.

Start by converting the cell array used above into a 4-by-1 MATLAB structure with six fields: f1 through f6 . Read field f5 for all rows, and MATLAB returns a comma-separated list.

## Assigning Output from a Comma-Separated List

You can assign any or all consecutive elements of a comma-separated list to variables with a simple assignment statement. Define the cell array C and assign the first row to variables c1 through c6 . C = cell(4,6); for k = 1:24 C{k} = k*2; end [c1,c2,c3,c4,c5,c6] = C{1,1:6}; c5 c5 = 34 When you specify fewer output variables than the number of outputs returned by the expression, MATLAB assigns the first N outputs to those N variables and ignores any remaining outputs. In this example, MATLAB assigns C{1,1:3} to the variables c1 , c2 , and c3 and ignores C{1,4:6} . [c1,c2,c3] = C{1,1:6}; You can assign structure outputs in the same manner. S = cell2struct(C,{ 'f1' , 'f2' , 'f3' , 'f4' , 'f5' , 'f6' },2); [sf1,sf2,sf3] = S.f5; sf3 sf3 = 38 You also can use the deal function for this purpose.

## Assigning to a Comma-Separated List

The simplest way to assign multiple values to a comma-separated list is to use the deal function. This function distributes its input arguments to the elements of a comma-separated list.

This example uses deal to overwrite each element in a comma-separated list. First initialize a two-element list. This step is necessary because you cannot use comma-separated list assignment with an undefined variable when using : as an index. See Comma-Separated List Assignment to an Undefined Variable for more information. c{1} = []; c{2} = []; c{:} ans = [] ans = []

Use deal to overwrite each element in the list. [c{:}] = deal([10 20],[14 12]); c{:} ans = 10 20 ans = 14 12

This example works in the same way, but with a comma-separated list of vectors in a structure field. s(1).field1 = [[]]; s(2).field1 = [[]]; s.field1 ans = [] ans = []

Use deal to overwrite the structure fields. [s.field1] = deal([10 20],[14 12]); s.field1 ans = 10 20 ans = 14 12

## How to Use Comma-Separated Lists

Common uses for comma-separated lists are:

## Constructing Arrays

Displaying arrays, concatenation, function call arguments, function return values.

These sections provide examples of using comma-separated lists with cell arrays. Each of these examples applies to structures as well.

You can use a comma-separated list to enter a series of elements when constructing a matrix or array. When you specify a list of elements with C{:,5} , MATLAB inserts the four individual elements.

When you specify the C cell itself, MATLAB inserts the entire cell array.

Use a list to display all or part of a structure or cell array.

Putting a comma-separated list inside square brackets extracts the specified elements from the list and concatenates them.

When writing the code for a function call, you enter the input arguments as a list with each argument separated by a comma. If you have these arguments stored in a structure or cell array, then you can generate all or part of the argument list from the structure or cell array instead. This can be especially useful when passing in variable numbers of arguments.

This example passes several name-value arguments to the plot function.

MATLAB functions can also return more than one value to the caller. These values are returned in a list with each value separated by a comma. Instead of listing each return value, you can use a comma-separated list with a structure or cell array. This becomes more useful for functions that have variable numbers of return values.

This example returns three values to a cell array.

## Fast Fourier Transform Example

The fftshift function swaps the left and right halves of each dimension of an array. For the vector [0 2 4 6 8 10] , the output is [6 8 10 0 2 4] . For a multidimensional array, fftshift performs this swap along each dimension.

fftshift uses vectors of indices to perform the swap. For the vector shown above, the index [1 2 3 4 5 6] is rearranged to form a new index [4 5 6 1 2 3] . The function then uses this index vector to reposition the elements. For a multidimensional array, fftshift constructs an index vector for each dimension. A comma-separated list makes this task much simpler.

Here is the fftshift function.

The function stores the index vectors in cell array idx . Building this cell array is relatively simple. For each of the N dimensions, determine the size of that dimension and find the integer index nearest the midpoint. Then, construct a vector that swaps the two halves of that dimension.

By using a cell array to store the index vectors and a comma-separated list for the indexing operation, fftshift shifts arrays of any dimension using just a single operation: y = x(idx{:}) . If you use explicit indexing, you need to write one if statement for each dimension you want the function to handle.

Another way to handle this without a comma-separated list is to loop over each dimension, converting one dimension at a time and moving data each time. With a comma-separated list, you move the data just once. A comma-separated list makes it easy to generalize the swapping operation to any number of dimensions.

## Troubleshooting Operations with Comma-Separated Lists

Some common MATLAB operations and indexing techniques do not work directly on comma-separated lists. This section details several errors you can encounter when working with comma-separated lists and explains how to resolve the underlying issues.

## Intermediate Indexing Produced a Comma-Separated List

Compound indexing expressions with braces or dots can produce comma-separated lists. You must index into the individual elements of the list to access them.

For example, create a 1-by-2 cell array that contains two 3-by-3 matrices of doubles.

Use brace indexing to display both elements.

Indexing into A this way produces a comma-separated list that includes both matrices contained by the cell array. You cannot use parentheses indexing to retrieve the entries at (1,2) in both matrices in the list.

To retrieve the entries at (1,2) in both of the matrices in the cell array, index into the cells individually.

## Expression Produced a Comma-Separated List Instead of a Single Value

Arguments for conditional statements, logical operators, loops, and switch statements cannot be comma-separated lists. For example, you cannot directly loop through the contents of a comma-separated list using a for loop.

Create a cell array of the first three prime numbers.

A{:} produces a comma-separated list of the three values.

Using for to loop through the comma-separated list generated by A{:} errors.

To loop over the contents of A , enclose A{:} in square brackets to concatenate the values into a vector.

## Assigning Multiple Elements Using Simple Assignment

Unlike with arrays, using simple assignment to assign values to multiple elements of a comma-separated list errors. For example, define a 2-by-3 cell array.

Assigning a value of 5 to all cells of the array using : as an index for B errors.

One way to accomplish this assignment is to enclose B{:} in square brackets and use the deal function.

## Comma-Separated List Assignment to an Undefined Variable

You cannot assign a comma-separated list to an undefined variable using : as an index. In the example in Assigning to a Comma-Separated List , the variable x is defined as a comma-separated list with explicit indices before assigning new values to it using : as an index.

Performing the same assignment with a variable that has not been initialized errors.

To solve this problem, initialize y in the same way as x , or create y using enough explicit indices to accommodate the number of values produced by the deal function.

cell | deal | struct

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

- Switzerland (English)
- Switzerland (Deutsch)
- Switzerland (Français)
- 中国 (English)

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

- América Latina (Español)
- Canada (English)
- United States (English)
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- United Kingdom (English)

## Asia Pacific

- Australia (English)
- India (English)
- New Zealand (English)

Contact your local office

## IMAGES

## VIDEO

## COMMENTS

MATLAB operators that contain a period always work element-wise. The period character also enables you to access the fields in a structure, as well as the properties and methods of an object. ... Uses: Cell array assignment and contents. Description: Use curly braces to construct a cell array, or to access the contents of a particular cell in a ...

3. a([1 1 1]) is unambiguous: it's numeric indexes, because the literal "1" is a double in Matlab, and Matlab won't convert to logicals in the index context. a([true true true]) would be logical indexes. That aside, Ben Voigt's comment makes total sense: += is a simple syntactic shorthand.

Operators and Elementary Operations. Arithmetic, relational, and logical operators, special characters, rounding, set functions. The MATLAB ® language uses many common operators and special characters that you can use to perform simple operations on arrays of any type. See MATLAB Operators and Special Characters for a comprehensive summary.

Operator Overloading Why Overload Operators. By implementing operators that are appropriate for your class, you can integrate objects of your class into the MATLAB ® language. For example, objects that contain numeric data can define arithmetic operations like +, *, -so that you can use these objects in arithmetic expressions. By implementing relational operators, you can use objects in ...

An assignment statement is used to assign a value to a variable name. Once the value has been assigned, the variable name can be used instead of the value. Matlab allows a variable to be assigned to a single scalar value, or an array of values. You will learn more about arrays in later lessons. The = sign is the assignment operator in Matlab ...

Assignment Statements. You can create your own variables, and give them values, with an assignment statement. The assignment operator is the equals sign (=), used like so: >> x = 6 * 7 x = 42. This example creates a new variable named x and assigns it the value of the expression 6 * 7. MATLAB responds with the variable name and the computed value.

Array left-division operator. ./. Array right-division operator. Colon; generates regularly spaced elements and represents an entire row or column. Parentheses; encloses function arguments and array indices; overrides precedence. Brackets; enclosures array elements. Decimal point. Ellipsis; line-continuation operator.

Assignment operators 1:10, Arrays 40:00, creating a vector with constant spacing (with colon) 44:00, Creating a vector with constant spacing by specifying th...

Remember that = is the assignment operator, and means "gets", whereas == means "is equal to". ... Matlab has lots of extremely useful builtin functions. Typically, there are three things involved in calling a function: the function name, its arguments , and its return value . ...

val can have any data type, and can include MATLAB expressions. If the value of the variable requires evaluation, MATLAB evaluates the expression in the function that contains the call to assignin, not in the workspace specified by ws. If val is a function handle, it must be evaluable in the function that calls assignin. Example: 5. Example ...

The equals sign (=) in MATLAB is the assignment operator, meaning that the expression on the right of the equals sign is assigned to the variable on the left. So, when you enter x = 3+4, MATLAB first evaluates 3+4 and then assigns the result (7) to the variable x.

letters and underscores. MATLAB is case sensitive and only the first 19 characters of any name are significant. The equal sign = is called the assignment operator. Expressions are composed from operators, function calls and variable names. Pressing ENTER normally signifies the end of a statement, causing MATLAB to interpret the

Description. The colon is one of the most useful operators in MATLAB ® . It can create vectors, subscript arrays, and specify for iterations. = fix(k-j). If j and k are both integers, then this is simply [j,j+1,...,k]. x = j:i:k creates a regularly-spaced vector x using i as the increment between elements.

Array left-division operator. ./. Array right-division operator. Colon; generates regularly spaced elements and represents an entire row or column. Parentheses; encloses function arguments and array indices; overrides precedence. Brackets; enclosures array elements. Decimal point. Ellipsis; line-continuation operator.

23. One line conditional assignment: a(a > 5) = 2; This is an example of logical indexing, a > 5 is a logical (i.e. Boolean or binary) matrix/array the same size as a with a 1 where ever the expression was true. The left side of the above assignment refers to all the positions in a where a>5 has a 1.

Operator Overloading Why Overload Operators. By implementing operators that are appropriate for your class, you can integrate objects of your class into the MATLAB ® language. For example, objects that contain numeric data can define arithmetic operations like +, *, -so that you can use these objects in arithmetic expressions. By implementing relational operators, you can use objects in ...

Arithmetic Operations. Addition, subtraction, multiplication, division, power, rounding. Arithmetic functions include operators for simple operations like addition and multiplication, as well as functions for common calculations like summation, moving sums, modulo operations, and rounding. For more information, see Array vs. Matrix Operations.

It's not possible to overload the = operator to do this. But (as you probably realised) there's no reason why you can't implement your assign method as you have done, and then call n = assign(m). answered Nov 22, 2011 at 12:53. Sam Roberts. 24.1k 1 41 64.

Matlab Assignment Operator. Matlab Assignment Operator can give you the best assistance for your assignment. We serve students as per their requirements based on the latest trends. In general, we have nearly 100+ employees working on all the latest algorithms, datasets, and tools used in Matlab. We show our uniqueness through our codes; we ...

You can assign any or all consecutive elements of a comma-separated list to variables with a simple assignment statement. Define the cell array Cand assign the first row to variables c1 through c6. C = cell ... Some common MATLAB operations and indexing techniques do not work directly on comma-separated lists. This section details several ...

MATLAB doesn't have conditional expressions, but in some situations you can get a similar effect by saying, e.g., var = cond*true_expr + (1-cond)*false_expr.Unlike C's conditional expression, this will of course always evaluate both true_expr and false_expr, and if cond happens not to be either 0 or 1 (note: false behaves like 0; true behaves like 1) you'll get crazy results.