int a=2,b=3,c=4;
printf("a=%d,b=%d\n",a,b,c);
what is the o/p?

Answers were Sorted based on User's Feedback



int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p?..

Answer / vignesh1988i

a=2 and b=3;;;; why it dosent print the value of 'c' is...
we didnt specify any format specifications....... so we wont
get c value...

but if we have given the format specifications and if we
dont give any argument to it... the garbage value will be
your o/p

printf("%d");
the o/p is :: some garbage values....

Is This Answer Correct ?    7 Yes 0 No

int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p?..

Answer / vignesh1988i

A=2,B=3


SINCE THEIR IS NO SPECIFIER FOR SPECIFING THE DATA TYPE OF VARIABLER c so only a & b wil get printed


thank u

Is This Answer Correct ?    5 Yes 1 No

int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p?..

Answer / srinivas

a=2,b=3



(for "c" variable no conversion char is there so it prints
only a&b values)

Is This Answer Correct ?    4 Yes 2 No

int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p?..

Answer / sanjay

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("\na=%d\n",a);
scanf("a=%d\n",a);
printf("a=%d\n",a);
printf("a=%d\n\n\n",&a);
//scanf("b=%d\n",&b);
//printf("a=%d\n",b);
//printf("a=%d\n",&a);
getch();
}

tell me the output why -12 and -28713 when i was enter 1 or
any digit?

Is This Answer Correct ?    2 Yes 0 No

int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p?..

Answer / vignesh1988i

this reply for Mr. Sanjay..........

one thing to understand , unless or until we initilize or get i/p from the user to any variables their GARBAGE CONTENT will be there inside the variable .... so like this u are printing the value of variable a wit out initilizing or feeding the i/p from the user.... SO FIRST PRINTF will show only garbage values , so only ur first output is -12.........

in scanf you have missed to specify the location of a where the value must get stored.... so , in the o/p screen u can type the value but it wont get stored in the memory location named as 'a'.... because you didn't specify the memory location of 'a' to the compiler.....

because of this in the next printf statement , it will print some other garbage values... remember that garbage values are subjected to change at instances....

next line you are tyrying to print the address of variable a... know one thing that the addresses are only unsigned ones... but you have given a format specification as %d which refers to a ordinary int or short integer which ranges from -32767 to 32768... so if any value goes beyond 32768 it will take the corresponding negative value.................
the other are commented , so i dont want to comment abt it..


hope you would have understood sir....

thank u

Is This Answer Correct ?    0 Yes 0 No

int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p?..

Answer / sriharsha karanth

a=2
b=3

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

If one always ought to act so as to produce the best possible circumstances, then morality is extremely demanding. No one could plausibly claim to have met the requirements of this "simple principle." . . . It would seem strange to punish those intending to do good by sentencing them to an impossible task. Also, if the standards of right conduct are as extreme as they seem, then they will preclude the personal projects that humans find most fulfilling. From an analytic perspective, the potential extreme demands of morality are not a "problem." A theory of morality is no less valid simply because it asks great sacrifices. In fact, it is difficult to imagine what kind of constraints could be put on our ethical projects. Shouldn't we reflect on our base prejudices, and not allow them to provide boundaries for our moral reasoning? Thus, it is tempting to simply dismiss the objections to the simple principle. However, in Demands of Morality, Liam Murphy takes these objections seriously for at least two distinct reasons. First, discussion of the simple principle provides an excellent vehicle for a discussion of morality in general. Perhaps, in a way, this is Murphy's attempt at doing philosophy "from the inside out.". . . Second, Murphy's starting point tells us about the nature of his project. Murphy must take seriously the collisions between moral philosophy and our intuitive sense of right and wrong. He [must do so] because his work is best interpreted as intended to forge moral principles from our firm beliefs, and not to proscribe beliefs given a set of moral principles. [Murphy] argues from our considered judgments rather than to them. . . For example, Murphy cites our "simple but firmly held" beliefs as supporting the potency of the over-demandingness objection, and nowhere in the work can one find a source of moral values divorced from human preferences. Murphy does not tell us what set of "firm beliefs" we ought to have. Rather, he speaks to an audience of well-intentioned but unorganized moral realists, and tries to give them principles that represent their considered moral judgments. Murphy starts with this base sense of right and wrong, but recognizes that it needs to be supplemented by reason where our intuitions are confused or conflicting. Perhaps Murphy is looking for the best interpretation of our convictions, the same way certain legal scholars try to find the best interpretation of our Constitution. This approach has disadvantages. Primarily, Murphy's arguments, even if successful, do not provide the kind of motivating force for which moral philosophy has traditionally searched. His work assumes and argues in terms of an inner sense of morality, and his project seeks to deepen that sense. Of course, it is quite possible that the moral viewpoints of humans will not converge, and some humans have no moral sense at all. Thus, it is very easy for the moral skeptic to point out a lack of justification and ignore the entire work. On the other hand, Murphy's choice of a starting point avoids many of the problems of moral philosophy. Justifying the content of moral principles and granting a motivating force to those principles is an extraordinary task. It would be unrealistic to expect all discussions of moral philosophy to derive such justifications. Projects that attempt such a derivation have value, but they are hard pressed to produce logical consequences for everyday life. In the end, Murphy's strategy may have more practical effect than its first-principle counterparts, which do not seem any more likely to convince those that would reject Murphy's premises. 1) The author suggests that the application of Murphy's philosophy to the situations of two different groups: a) would help to solve the problems of one group but not of the other. b) could result in the derivation of two radically different moral principles. c) would be contingent on the two groups sharing the same fundamental beliefs. d) could reconcile any differences between the two groups. 2) Suppose an individual who firmly believes in keeping promises has promised to return a weapon to a person she knows to be extremely dangerous. According to Murphy, which of the following, if true, would WEAKEN the notion that she should return the weapon? a) She also firmly believes that it is morally wrong to assist in any way in a potentially violent act. b) She believes herself to be well-intentioned in matters of right and wrong. c) The belief that one should keep promises is shared by most members of her community. d) She derived her moral beliefs from first-principle ethical philosophy. 3) The passage implies that a moral principle derived from applying Murphy's philosophy to a particular group would be applicable to another group if: a) the first group recommended the principle to the second group. b) the moral viewpoints of the two groups do not converge. c) the members of the second group have no firmly held beliefs. d) the second group shares the same fundamental beliefs as the first group. 4) According to the passage, the existence of individuals who entirely lack a moral sense: a) confirms the notion that moral principles should be derived from the considered judgments of individuals. b) suggests a potential disadvantage of Murphy's philosophical approach. c) supports Murphy's belief that reason is necessary in cases in which intuitions are conflicting or confused. d) proves that first-principle strategies of ethical theorizing will have no more influence over the behavior of individuals than will Murphy's philosophical approach. 5) Which of the following can be inferred about "doing philosophy from the inside out?" a) Murphy was the first philosopher to employ such an approach. b) It allows no place for rational argument in the formation of ethical principles. c) It is fundamentally different from the practice of first-principle philosophy. d) It is designed to dismiss objections to the "simple principle." 6) A school board is debating whether or not to institute a dress code for the school's students. According to Murphy, the best way to come to an ethical decision would be to: a) consult the fundamental beliefs of the board members. b) analyze the results of dress codes instituted at other schools. c) survey the students as to whether or not they would prefer a dress code. d) determine whether or note a dress code has ever been instituted in the school's history

0 Answers   Accenture,


Explain pointer. What are function pointers in C?

0 Answers   HCL,


What is use of integral promotions in c?

0 Answers  


There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.

1 Answers   HCL, iGate,


what is the disadvantage of using macros?

1 Answers   Wipro,






WHAT IS C?

6 Answers  


hat is a pointer?

4 Answers   Assurgent,


What should malloc() do? Return a null pointer or a pointer to 0 bytes?

0 Answers  


which types of data structure will i use to convert infix to post fix???

5 Answers   IIT,


What are identifiers and keywords in c?

0 Answers  


What is the benefit of using const for declaring constants?

0 Answers  


Write a program that accepts a string where multiple spaces are given in between the words. Print the string ignoring the multiple spaces. Example: Input: “ We.....Are....Student “ Note: one .=1 Space Output: "We Are Student"

6 Answers   IBM,


Categories