C Program #1

What is the output of the following C program?

RUN CODE ONLINE
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	cout << sizeof("GeeksforGeeks") << endl;
	cout << strlen("GeeksforGeeks");
	return 0;
}

Output

14
13

The output of the sizeof operator is 14, which is the size of the string including the null character. While the strlen() function returns a string that is exactly 13 characters long, excluding null characters.

%d