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'

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

4545


What is difference between main and void main?

631


What does printf does?

753


What is the difference between array_name and &array_name?

783


What is quick sort in c?

588






The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.

1637


What is break in c?

590


Where register variables are stored in c?

556


How to write a multi-statement macro?

629


What are all different types of pointers in c?

581


What are the types of functions in c?

579


What is a pointer value and address in c?

636


What are the different data types in C?

731


how to write a c program to print list of fruits in alpabetical order?

1797


Why doesnt that code work?

604