S
shawn
test1.c
------------------------------
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
const int MAX_CHAR_NUM=10;
char name[MAX_CHAR_NUM]="Computer";
printf("My name is %s.\n", name);
exit(EXIT_SUCCESS);
}
test2.c
-----------------------------
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
enum width {MAX_CHAR_NUM=10, OTHER};
char name[MAX_CHAR_NUM]="Computer";
printf("My name is %s.\n", name);
exit(EXIT_SUCCESS);
}
Test1 can not be compiled.
And test2.c can.
Why?
------------------------------
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
const int MAX_CHAR_NUM=10;
char name[MAX_CHAR_NUM]="Computer";
printf("My name is %s.\n", name);
exit(EXIT_SUCCESS);
}
test2.c
-----------------------------
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
enum width {MAX_CHAR_NUM=10, OTHER};
char name[MAX_CHAR_NUM]="Computer";
printf("My name is %s.\n", name);
exit(EXIT_SUCCESS);
}
Test1 can not be compiled.
And test2.c can.
Why?