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...


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

24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?

0 Answers  


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

0 Answers  


is it possible to change the default calling convention in c ?

1 Answers   Aptech,


The differences between Windows XP and Windows Visa

8 Answers   HCL,


write a c program to find largest number in matrix(in each row,each column, diagonally, and in the whole matrix)? Its urgent.

2 Answers  


Why use int main instead of void main?

0 Answers  


Can include files be nested? How many levels deep can include files be nested?

0 Answers   Aspire, Infogain,


What is C language Terminator?

15 Answers   TCS,


Why is the code below functioning. According to me it MUST NOT.

1 Answers  


Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line.

4 Answers   Persistent, Subex,


main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); } wat is the o/p and how?

12 Answers   Tech Mahindra,


WHAT IS ABSTRACT DATA TYPE

4 Answers   Wipro,


Categories