c与c++ static

#include <stdio.h>
int main()
{
int x = 10;
static int y = x;
	
if(x == y)
	printf("Equal");
else if(x > y)
	printf("Greater");
else
	printf("Less");
return 0;
}

  In C, static variables can only be initialized using constant literals. This is allowed in C++ though

posted @ 2021-10-05 16:19  xmydis  阅读(23)  评论(0)    收藏  举报