in Programming in C retagged by
351 views
1 vote
1 vote

DOUBT:

suppose a memory space of 16B is given and it is asked that  what is the maximum length of string it can store.

then do we have to consider the space taken by the “\0” also? 

OR just the string length?

in Programming in C retagged by
351 views

1 comment

So the ans is only string length, but it is for maximum length of string.
0
0

1 Answer

0 votes
0 votes

I think yes because it differentiate the two strings like iitbiitd here is two string so we have to take extra space to differentiate between them that is called null “\0” 

 iitb\0iitd\0

…………..

yes it differentiate two strings but null terminating character does not take any space. and null terminating character also take space.

edited by

4 Comments

so for 16B it can store a maximum 15B length of string right? and 1B for NULL .

0
0

@Abhrajyoti00 no difference.

0
0

@Abhrajyoti00 no actually it can store 16B of maximum length of string.

now after 6 byte it get overflow.

0
0