Main content: The maximum value of the time_t, the strlen is the length, malloc allocation character memory details, switch in the default details
#include <stdio.h> #include <time.h>int main () { /************************************ time_t max Test **************** / time_t biggest = 0x7fffffff; printf ("biggest =%s", CTime (&biggest)); /* CTime () function converts the parameter to local time, here is a detail, I don't have a newline in printf, but the output is wrapped, and the following test CTime (&biggest) returns a string containing ' \ n ' really */ char *test = CTime (&biggest); while (*test++) { if (*test = = ' \ n ') printf ("Find ' \\n ' int test\n "); } // printf (" biggest =%s \ n ", Asctime (Gmtime (&biggest))); //Correct statement is this sentence, the above statement has a time difference problem /************************************************ strlen () function test *************************** / char *a = "abc"; printf ("strlen =%d\n", Strlen (a)); //strlen The length of the string, which does not contain the most ' malloc (strlen (a));//This is not true because of the use of malloc (Strlen (a) +1); To apply for ' /*************************************************************** ' memory ** switch Test Result Description: Default can be placed anywhere in switch ******************************************************************/ int b = 2; const int c = 2; Add Case c:printf ("C") to the switch and you can test that the Const modifier's C is not constant switch (b) { case 0: printf ("case:0\n"); & nbsp break; case 1: printf ("case:1\n"); break; default: printf ("default\n"); break; case 2: printf ("case:2\n"); while (b = = 2) { printf ("B = 1\n"); break; //break; To jump out of the nearest layer of loops or switch statements, jump out of the loop, and then proceed to the next } printf ("after break,the Program Run here!\n "); break; } return 0;}
Output:
Program Ape---C language details 17 (the maximum value for time_t, strlen for length, malloc to allocate character memory details, switch in default details)