#include
#include
main( )
{
char a[]="hello";
char b[]={ 'h', 'e', 'l','l','o' };
printf( "Size a=%d\t b=%d ", sizeof( a ), sizeof( b ) );
getch( );
}
What would be the output of the above program?
Ans:
Size a=6 b=5
yes, because the array a contains a '\0'( NULL character ) at the end of the string. So it returns 6. But the array b is formed character by character. So there is noway for NULL. SO it returns 5.
No comments:
Post a Comment