Nguyễn Văn Nhật
New member
What is the output of the following code?
A. 14
B. 0
C. Compile time error
D. Runtime error
Code:
#include<stdio.h>
int get_len(char *s)
{
int len = 0;
while(s[len] != '\0')
len++;
return len;
}
int main()
{
char *s = "lengthofstring";
int len = get_len(s);
printf("%d",len);
return 0;
}
B. 0
C. Compile time error
D. Runtime error