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


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

Answers were Sorted based on User's Feedback



main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / ashwin

4 2 4

sizeof('3') means it will take ascii value which is an
integer, it shows size of integer.

sizeof("3") means, here it will treat it as an array, it
will print size of an array, so array contain '3' and '\0'
so out put is 2.

try size("3ashwin") it will give 8 as out put.

sizeof(3) means directly we asking size of an integer.

thank you

if is an wrong answer plz write correct answer to

molugu.ashwin@gamil.com

Is This Answer Correct ?    71 Yes 17 No

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / animesh_chakraborty

answer is:124
i compiled it and it has shown this result .
i thing it is correct answer.

Is This Answer Correct ?    10 Yes 5 No

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / k.thanigaivel

This output is
4 2 4

Explanation:
sizeof('1 or 2 or 3,......or n')=4

sizeof("0")=2
sizeof("10")=3
sizeof("100")=4
sizeof("1000")=5
sizeof("10000")=6
.
.
.
.
.
sizeof("n")=n

sizeof(1 or 2 or 3......or n)=4

Is This Answer Correct ?    27 Yes 25 No

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / deepali chandra

o/p 1 2 2
sizeof('3')takes 3 as character and so, size of a character
is 1 byte

sizeof("3") takes 3 as a string so, one
character 3 and end character '\0'. so, sizeof("3") gives
o/p 2

and
sizeof(3) takes 3 as integer so size of an integer is 2
bytes

Is This Answer Correct ?    17 Yes 22 No

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / manne ranjith

2 2 2

I compiled this in system,this is correct answer.check it
once...............

Is This Answer Correct ?    18 Yes 23 No

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / niru

2 2 2
it returns the size of the int.
if the compiler is 32bit, size of the int=4
o/p: 4 4 4

Is This Answer Correct ?    3 Yes 8 No

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / niru

2 2 2
it returns the size of the int.
if the compiler is 32bit, size of the int=4
o/p: 4 4 4
For example:
void main()
{
long int i;
clrscr();
printf("%d %d %d \n",sizeof(i),sizeof("3"),sizeof(3));
getch();
}
output:4 2 2

Is This Answer Correct ?    1 Yes 6 No

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / guddu singh

112

Is This Answer Correct ?    0 Yes 5 No

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / vinay kabra

Answer is : 1 2 2
because

sizeof('3')takes 3 as character and so, size of a character
is 1 byte

sizeof("3") takes 3 as a string so, here strinf contains one
character 3 and end character '\0'. so, sizeof("3") gives o/p 2

and
sizeof(3) takes 3 as integer so size of an integer is 2 bytes

Is This Answer Correct ?    18 Yes 24 No

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }..

Answer / loganathan

2 2 2
it returns the size of the integer

Is This Answer Correct ?    9 Yes 15 No

Post New Answer

More C Interview Questions

Difference between goto, long jmp() and setjmp()?

0 Answers   EXL,


write a program to display the numbers having digit 9 in the given range from 1 to 100

1 Answers  


Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?

0 Answers   TCS,


Why c is called object oriented language?

0 Answers  


Write a program in C to print the alphabets in order as on a mobile phone.i.e:When 2 is pressed once 'a' prints and if it is pressed two times 'b' prints and so on.we have to print all the alphabets as on mobile phone like this.

1 Answers   Wipro,


what is difference between array and structure?

44 Answers   College School Exams Tests, CTS, Google, HCL, IBM, Motorola, TCS,


Just came across this question, felt worth sharing, so here it is I want you to make a C/C++ program that for any positive integer n will print all the positive integers from 1 up to it and then back again! Let's say n=5 I want the program to print: 1 2 3 4 5 4 3 2 1. Too easy you say? Okay then... You can ONLY USE: 1 for loop 1 printf/cout statement 2 integers( i and n) and as many operations you want. NO if statements, NO ternary operators, NO tables, NO pointers, NO functions!

1 Answers  


How to add two numbers without using semicolon at runtime

2 Answers  


what is array?

63 Answers   Amdocs, HCL,


How can I direct output to the printer?

0 Answers  


what is c

1 Answers  


plz answer.. a program that takes a string e.g. "345" and returns integer 345

4 Answers  


Categories