1.

In which way can SAM be stored in an array?(a) char name[]=”SAM”(b) char name[6]={‘S’,’A’,’M’}(c) char name[6]={“S”,”A”,”M”}(d) char name [6]={‘S’,’A’,’M’,’\0’}The question was asked in quiz.This intriguing question comes from Array Reference in portion Syntax Directed Definition and Translations of Compiler

Answer»

The correct answer is (d) char NAME [6]={‘S’,’A’,’M’,’\0’}

BEST explanation: The array consists of the word SAM and also a NULL character.



Discussion

No Comment Found

Related InterviewSolutions