#includestdio.h#includestdlib.hvoidmain(){intn,i,cur,c;printf(请输入数组的长度:\n);scanf(%d,&n);char*array,cln;if(n0){printf(数组的长度不能小于0,请重新输入!)scanf(%d,n);}else{array=(char*)malloc(n);printf(请输入数组的元素:);for(i=0;in;i++){scanf(%d,&cln);if(i%10==0){printf(\n);}}}cur=array[0];c=1;for(i=1;in;i++){if(c==0){cur=array[i];c++;}elseif(array[i]!=cur){c--;}elseif(){c++;}}printf(主元素是:%d,cur);printf(\n);}