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
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 ? | 70 Yes | 17 No |
answer is:124
i compiled it and it has shown this result .
i thing it is correct answer.
Is This Answer Correct ? | 10 Yes | 4 No |
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 |
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 |
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 |
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 |
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 |
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 |
What is the use of static variable in c?
How the c program is executed?
Explain c preprocessor?
what is compiler
Sir i want e-notes of C languge of BAlaguruswami book i.e scanned or pdf file of balaguruswamy book on c language.PLEASE SEND ME on my mail id ajit_kolhe@rediff.com
What do you know about the use of bit field?
How are Structure passing and returning implemented by the complier?
in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ?
i am using gsm modem ! I USE CMGL COMMAND TO DISPLAY THE LIST OF MESSAGES ! I WANT TO READ EACH MESSAGE ONE BY ONE AND GET EACH MESSAGE INDEX USING C PROGRAM ! THE RESPONSE OF THE MODULE AFTER AT+CMGL IS ---CMGL: 1,"REC READ","+85291234567",,"07/05/01,08:00:15+32",145,37 It is easy to list SMS text messages.---- I WANT THE PROGRAM TO GET THE NUMBER "37"{MESSAGE LENGTH} AS WELL AS "1"(MESSAGE INDEX NUMBER" PLEASE HELP
what is the difference between c and c++?
Write a program for deleting duplicate elements in an array
Explain is it better to bitshift a value than to multiply by 2?