Some #Strings Attached

Computer Science Level pending

Which of the following is the correct output for the program given below?

include<stdio.h>

include<string.h>

int main()

{

static char s[] ="Hello!"; printf("%d\n",*(s + strlen(s))); return 0;

}

16 8 0 Error

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Hasmik Garyaka
Sep 18, 2017

C strings always end with ascii code 0. So on s + strlen(s) place of any s we find 0.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...