IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C# Programming Java Programming
Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C Programming - Expressions - Discussion

@ : Home > C Programming > Expressions > General Questions - Discussion

Read more:

"Nothing in life is to be feared, it is only to be understood."
- Marie Curie
4. 

Which of the following is the correct order if calling functions in the below code?
a = f1(23, 14) * f2(12/4) + f3();

[A]. f1, f2, f3
[B]. f3, f2, f1
[C]. Order may vary from compiler to compiler
[D]. None of above

Answer: Option B

Explanation:

Here, Multiplication will happen before the addition, but in which order the functions would be called is undefined. In an arithmetic expression the parenthesis tell the compiler which operands go with which operators but do not force the compiler to evaluate everything within the parenthesis first.


Mithranjan said: (Mon, Sep 6, 2010 02:30:09 PM)    
 
() has the highest priority and it has left to right associativity so first f1, f2, f3 will be evaluated and then * is performed between the value returned from f1 and f2 and the + is computed with f3. So ans is A. Am I right?.

Sri Krishna said: (Tue, Nov 1, 2011 07:26:12 PM)    
 
The () doesn't have the highest precedence but grouping is more visible with high precedence operators. take a case:

int x=3,y=5,p=10,z;
z = (x>y)||(x==0)&&(y<<1);
printf("%d",z);

The output should be like (x>y)||(x==0) evaluated first and then the and operation. but as and has higher precedence, it forma a group leading to evaluation of (x>y) first and then anding with ((x==0)&&(y<<1)).

If you get the thing then try to answer the above question.

Nikita Sahane said: (Sun, Jan 29, 2012 11:21:11 AM)    
 
What will be the answer of above example you gave i.e. value of z ?

Write your comments here:
Name *:     Email:


© 2008-2011 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Advertise     Contact us: info@indiabix.com     Follow us on twitter!