What is the size of ans variable after the following code? [code]sprintf('23 23') ans= ’23 23’[/code]

thanhthao

New member
What is the size of ans variable after the following code?
Code:
sprintf('23 23')
ans=
      ’23 23’
A. 14 bytes
B. 10 bytes
C. Error
D. 1*5
 
Answer: b
Explanation: The number of elements in the character array, given as input are 5. They are ‘2’, ‘3’, ‘ ’, ‘2’, ‘3’. Hence, the total size will be 10 bytes as each element will take 2 bytes. The ‘’ are not taken as elements.
 

Tìm kiếm

Back
Top