Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


a=(1,2,3);
b=1,2,3;
c=1,(2,3);
d=(1,2),3;
what's the value of 'a','b','c','d'

Answers were Sorted based on User's Feedback



a=(1,2,3); b=1,2,3; c=1,(2,3); d=(1,2),3; what's the value of 'a','b',&..

Answer / vadivelt

3 1 1 2.

To analyse, lets rewrite the prgm.

#include<stdio.h>
#include<conio.h>
main()
{
int a, b, c, d;
a = (1,2,3);
b = 1,2,3;
c = 1,(2,3);
d = (1,2),3;
printf("%d %d %d %d", a, b, c, d);
getch();
}


Note:Precedence of evaluation of the statements would be:
for (1,2,3) it is -> ie., left to right
for 1,2,3 it is <- ie., right to left.

Now,
1. In statement a = (1,2,3); due to the precedence(->)
latest vale of a would be 3.

2. In the same way( <- ) in the statement b = 1,2,3; latest
value of b would be 1.

In statement c = 1,(2,3); and d = (1,2),3; there are two
precedency lavel.

Lets analyse.

3.In c = 1,(2,3); As we know the basic rule in C that the
expression in a statement with braces evaluated first. So
the outcome of (2,3) would be 3(cos., ->), then the
statement c = 1,(2,3); shall be replaced as c = 1, 3; in
runtime. So in the next execution c's latest value would be
1. Cos now precedence would be <-.

4. In the same way, first d = (1,2),3; will be replaced as
d = 2,3 then d holds the value 2 as latest value.

Is This Answer Correct ?    11 Yes 0 No

a=(1,2,3); b=1,2,3; c=1,(2,3); d=(1,2),3; what's the value of 'a','b',&..

Answer / srsabariselvan3

a=3
b=1
c=1
d=2

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More C Interview Questions

What is the difference between array_name and &array_name?

0 Answers  


Write a program to print distinct words in an input along with their count in input in decreasing order of their count

0 Answers  


main() { char *p; p="Hello"; printf("%c\n",*&*p); }

2 Answers   ME,


What is a constant?

0 Answers  


main() {int i=5; // line 1 i=(++i)/(i++); // line 2 printf("%d",i); // line 3 } output is 2 but if we replace line 2 and line 3 by printf("%d",i=(++i)/(i++)); then output is 1. Why?

1 Answers   GATE,


In C programming, what command or code can be used to determine if a number of odd or even?

0 Answers  


how to find the largest element of array without using relational operater?

6 Answers   Satyam, Wipro,


what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7

4 Answers   TCS,


Can we change the value of #define in c?

0 Answers  


What are local variables c?

0 Answers  


How can I sort a linked list?

0 Answers  


An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above

0 Answers  


Categories