MCQ Single Best Answer Not Set

QFor the following code snippet:
       char *str = "atnyla.com\0" "training classes";
The character pointer str holds reference to string:

ID: #1360 Constant in C Language 1,180 views
Question Info
#1360Q ID
Not SetDifficulty
Constant in C LanguageTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A atnyla.com
  • B atnyla.com\0training classes
  • C atnyla.comtraining classes
  • D Invalid declaration
Correct Answer: Option B

Explanation

Answer:b
'\0' is accepted as a char in the string. Even though strlen will give length of string "atnyla.com", in memory str is pointing to entire string including training classes"

Share This Question

Challenge a friend or share with your study group.