I'm going through my professors notes right now and he says in big bold print "Length does not include terminating null". I've looked at 2 different versions of this and in both cases it counts the terminating null. Can someone explain why this is happening.
Case 1
#include <stdio.h>
#include <string.h>
int main ()
{
char mySchool[29] = "\n";
printf (mySchool);
printf ("Length of string mySchool is %d\n", strlen(mySchool));
printf ("Size of string mySchool is %d\n", sizeof(mySchool));
return 0;
}
Case 2
#include <stdio.h>
#include <string.h>
int main ()
{
char mySchool[29] = "University of South Florida\n";
printf (mySchool);
printf ("Length of string mySchool is %d\n", strlen(mySchool));
printf ("Size of string mySchool is %d\n", sizeof(mySchool));
return 0;
}