473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Output and operator precedence in C

3+3/5*3

in the above problem what will be the output.
Also, as per the left to right associativity of the arithmatic opertaors what should be done frist? / or *. I need the answer and not jokes.
May 9 '07 #1
2 1321
mac11
256 100+
I think you can do the math on your own.

Here's a link to a page that tells you how C handles operators - which is what your question is really getting at anyway...
http://en.wikipedia.org/wiki/Operators_in_C_and_C++
May 9 '07 #2
sicarie
4,677 Expert Mod 4TB
3+3/5*3

in the above problem what will be the output.
Also, as per the left to right associativity of the arithmatic opertaors what should be done frist? / or *. I need the answer and not jokes.
Did you try plugging that into the compiler? That would give you the answer pretty quickly, and associativity can also be determined by playing around with parentheses - seeing what parentheses will return the correct answer.

Also, please read our Posting Guidelines, which request that you do not use profanity (which I have deleted), post what you have tried, and the specific part you are stuck with. Thanks!
May 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Derek | last post by:
I came upon the idea of writting a logging class that uses a Python-ish syntax that's easy on the eyes (IMO): int x = 1; double y = 2.5; std::string z = "result"; debug = "Results:", x, y,...
4
by: Master of C++ | last post by:
Hi, This is a simple question. In the following example, .. class Vector .. { .. private: .. int *Numbers; .. int vLength; ..
4
by: mux | last post by:
Hi I found out that the following piece of code throws an error. 1 #include "stdio.h" 2 3 int main() 4 { 5 int a,b; 6 a= 10;
17
by: Anoob | last post by:
Can we consider () unary operator when calling a function, in exps eq. f(), ( 1 + 2). But when we call function f( 10 ) it is a binary operator. Even if we pass f( 10, 20) as we are using ,...
21
by: siliconwafer | last post by:
Hi, In case of following expression: c = a && --b; if a is 0,b is not evaluated and c directly becomes 0. Does this mean that && operator is given a higher precedence over '--'operator? as...
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
9
by: marko | last post by:
/* code start */ int a = 0; /* expected evaluation and excution order with precedence in mind /* False(3) , True(1), False(2) */ if ( (a=1) == 0 || 0 != 1 && (a =2) == 1) putchar('T');...
5
by: paulo | last post by:
Can anyone please tell me how the C language interprets the following code: #include <stdio.h> int main(void) { int a = 1; int b = 10; int x = 3;
8
by: subramanian100in | last post by:
Consider int i = 10; Why do we say that ++i yields an Lvalue and i++ yields an Rvalue ? I thought both these expressions yield only values. I am unable to understand the difference
6
by: newbie | last post by:
I have a script given to me by a co-worker to convert into VB; I can get the same results but I cannot fully understand the logic here... can someone please help me write this in a more...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.