main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4
Answers were Sorted based on User's Feedback
Answer / lalitha
size of char is 1
and size of int is 2/4 depending on n-bit m/c
| Is This Answer Correct ? | 24 Yes | 6 No |
Answer / lalitha
@ guest
if we give sizeof(char) or
char ch;
sizeof(ch) the result is 1
and if we give sizeof('1)
sizeof('c') the result is 2/4
does it treat as AsCII value which is an interger?????
how come????
| Is This Answer Correct ? | 12 Yes | 1 No |
Answer / anil
for the above question the give options are not suitable
it gives the out put as:
1, 2
| Is This Answer Correct ? | 9 Yes | 6 No |
Answer / praneeth
In C programming language
The size of character literal is size of int. (2 or 4)
ex:: sizeof('A') == sizeof(65)
the size of char is 1
ex:: char ch = 'a';
sizeof(ch) == 1
I hope U understand....
praneeth
| Is This Answer Correct ? | 7 Yes | 4 No |
Answer / ab
answer can be both a and d part..its compiler dependent...
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / sai
Answer will be (2,2).
EXPLANATION:
In the above printf() statement the size of the char is 2 because
it will takes ASCII value for 'c' because "%d" is the integer specifier.
| Is This Answer Correct ? | 3 Yes | 0 No |
Is the following code legal? typedef struct a { int x; aType *b; }aType
#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }
print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!
35 Answers Tata Elxsi, TCS, VI eTrans,
main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }
int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }
main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }
How can i find first 5 natural Numbers without using any loop in c language????????
Develop a routine to reflect an object about an arbitrarily selected plane
Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.
main() { printf("%x",-1<<4); }
int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }
plz tell me the solution.......... in c language program guess any one number from 1 to 50 and tell that number within 8 asking question in yes or no...............