C
Programming and Technical
Programming
Program
find the output
main()
{
printf("%d%d"size of ("Hcl
technologies"),strlen("HCL Technologies"));
}
Read Solution (Total 22)
-
- 17 16
bz size of returns allocated memory with n and for strlen returns no of chars. - 10 years agoHelpfull: Yes(5) No(2)
- 15 16
sizeof is calculates no.of.character present in the string is 15 and strlen is calculates total no.of.character with space is 16. - 10 years agoHelpfull: Yes(4) No(0)
- bt i thnk its 16,17
coz shoulld also be count in both in string or sizeof too.. total characters are 15 with space 16 and for string with backspace ( ) 17. - 10 years agoHelpfull: Yes(3) No(0)
- Error syntactic error ...no comma in printf statment
- 10 years agoHelpfull: Yes(3) No(1)
- 16 and 16 sizeof will also count null character where as strlen will count only length of character
- 10 years agoHelpfull: Yes(3) No(0)
- 17,16
in case of size of it will count char,space and null character but in case of strlen it will only count space and no of char in it. - 10 years agoHelpfull: Yes(2) No(0)
- 17,16
strlen counts characters excluding null spaces while sizeof includes null characters - 8 years agoHelpfull: Yes(2) No(0)
- 16 because number of characters and null string
- 10 years agoHelpfull: Yes(1) No(0)
- size of string is 32 and strlen("HCL technologies") is 16
ans : 32 16 - 10 years agoHelpfull: Yes(1) No(0)
- 17 and 16, space is also count as a character.
- 10 years agoHelpfull: Yes(1) No(1)
- 16 16 (which is the number of characters in string)
- 10 years agoHelpfull: Yes(0) No(0)
- 16 16 (which is size of string and length)
- 10 years agoHelpfull: Yes(0) No(0)
- The answer will be 16 17 coz strlen calculate total no of character with null at last.
- 10 years agoHelpfull: Yes(0) No(1)
- 16 17
sizeof returns number of characters where as strlen returns number of characters and null character... - 10 years agoHelpfull: Yes(0) No(1)
- size of operator nt count no of character present in string and strlen count no of character with space 15,16
- 10 years agoHelpfull: Yes(0) No(1)
- Code has error in it, after debugging it this will run properly though the questions logic remains intact:
#include
#include
void main()
{
printf("%d n%d",sizeof ("Hcltechnologies"),strlen("HCL Technologies"));
getch();
} - 10 years agoHelpfull: Yes(0) No(2)
- 16 16 because sizeof(string) retun no. of character+1(for )
but strlen(string) return only no. of character - 9 years agoHelpfull: Yes(0) No(0)
- ans 17 and 16
- 9 years agoHelpfull: Yes(0) No(0)
- since in the question,',' is not present after the ending quote.Therefore error.
- 8 years agoHelpfull: Yes(0) No(0)
- sizeof operator considers null character at the end of string so 17
strlen fun doesnt consider null at the end of string so 16 - 7 years agoHelpfull: Yes(0) No(0)
- 15,16
sizeof calculates no. of characters and strlen calculates no. of characters with space - 7 years agoHelpfull: Yes(0) No(0)
- The answer is 1716
- 7 years agoHelpfull: Yes(0) No(0)
C Other Question
find the output
main( )
{
static int a[ ] = {0,1,2,3,4};
int *p[ ] = {a,a+1,a+2,a+3,a+4};
int **ptr = p;
ptr++;
printf(“n %d %d %d”, ptr-p, *ptr-a, **ptr);
*ptr++;
printf(“n %d %d %d”, ptr-p, *ptr-a, **ptr);
*++ptr;
printf(“n %d %d %d”, ptr-p, *ptr-a, **ptr);
++*ptr;
printf(“n %d %d %d”, ptr-p, *ptr-a, **ptr);
}
What is the sizeof(long int)