#include <stdio.h> void main() { char diamond[][5]={{'','','*'},{'','*','','*'},{'*','','','*'},{''

编译调试通不过 为什么阿?
--------------------配置: mingw5 - CUI Debug, 编译器类型: MinGW--------------------

检查文件依赖性...
正在编译 D:\用户目录\Documents\C-Free\Projects\lx\main.c...
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:22: empty character constant
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:25: empty character constant
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:34: empty character constant
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:41: empty character constant
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:54: empty character constant
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:57: empty character constant
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:66: empty character constant
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:73: empty character constant
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:82: empty character constant
[Error] D:\用户目录\Documents\C-Free\Projects\lx\main.c:4:85: empty character constant
[Warning] D:\用户目录\Documents\C-Free\Projects\lx\main.c:3: warning: return type of 'main' is not `int'
[Warning] D:\用户目录\Documents\C-Free\Projects\lx\main.c:12:2: warning: no newline at end of file

构建中止 main: 10 个错误, 2 个警告
#include <stdio.h>
void main()
{
char diamond[][5]={{'','','*'},{'','*','','*'},{'*','','','*'},{'','*','','*'},{'','','*'}};
int i,j;
for (i=0;i<5;i++)
{
for (j=0;j<5;j++)
printf("%c",diamond[i][j]);
printf("\n");
}
}

/*那是因为在单引号里未键入空格,真是的,修改如下*/
#include <stdio.h>
int main(void)
{
char diamond[][5]={{' ',' ','*'},{' ','*',' ','*'},{'*',' ',' ',' ','*'},{' ','*',' ','*'},{' ',' ','*'}};
int i,j;
for (i=0;i<5;i++)
{
for (j=0;j<5;j++)
printf("%c",diamond[i][j]);
printf("\n");
}
return 0;
}
温馨提示:内容为网友见解,仅供参考
第1个回答  2010-12-18
char diamond[][5]={{'','','*'},{'','*','','*'},{'*','','','*'},{'','*','','*'},{'','','*'}};
我试了一下,写成这样能通过编译
char diamond[][5]={{' ',' ',' ','*'},{' ','*',' ','*'},
{'*',' ',' ','*'},{' ','*',' ','*'},{' ',' ',' ','*'}};
第2个回答  2010-12-18
貌似要输出一个菱形?

你把所有的''改为' ',中间夹个空格。

...{ char diamond[][5]={{'','','*'},{'','*','','*'},{'*...
\/*那是因为在单引号里未键入空格,真是的,修改如下*\/ include <stdio.h> int main(void){ char diamond[][5]={{' ',' ','*'},{' ','*',' ','*'},{'*',' ',' ',' ','*'},{' ','*',' ','*'},{' ',' ','*'}};int i,j;for (i=0;i<5;i++){ for...

C 语言 学习 输出菱形
include<stdio.h> void main (){ char diamond[][5]={ {' ',' ','*'},{' ','*',' ','*'},{'*',' ',' ',' ','*'},{' ','*',' ','*'}, {' ',' ','*'} };int i,j;for(i=0;i<5;i++){ for(j=0;j<5;j++)printf("%c",diamond[i][j]);print...

C语言数组输出一个钻石图形的程序有小问题,在线等啊
1.char diamond[][5]={{' ',' ','*'},{' ','*',' ','*'},{'*',' ',' ',' ','*'},{' ','*',' ','*'},{' ',' ','*'}};这个结束处的分号改成英文的。2.少一个 “}”。

初始值设定项太多
{char diamond[][5]={{' ',' ',' ','*'},{' ',' ','*',' ','*'},{' ','*',' ','*',' ','*'} };第三个大括号里有六个元素,定义的是5个元素

如何用C语言画一个心形?
include <stdio.h> void main(){ unsigned char diamond[4][5]={{' ','*',' ','*',' '},{'*',' ','*',' ','*'},{' ','*',' ','*',' '},{' ',' ','*',' ',' '}};unsigned short int i,j;for(i=0;i<4;i++)for(j=0;j<5;j++){ printf("%c",...

c语言输出菱形
include <stdio.h> void main(){ for(int i = 1; i <= 9; i += 2){ for(int j = 0; j < (9-i)\/2; j++ )printf(" ");for(int j = 1; j <= i; j++){ printf("*");} printf("\\n");} for(int i = 9; i >= 1; i -= 2){ for(int j = 0; j < ...

请教一个打印菱形星号算法?
include <stdio.h> void main(){ char diamond[7][7]={{' ',' ',' ','*'},{' ',' ','*','*','*'},{' ','*','*','*','*','*'},{'*','*','*','*','*','*','*'},{' ','*','*','*','*','*'},{' ',' ','*','*','*'},{' ',' '...

用C语言,定义一个二维字符数组,输出一个空心菱形
int n,i,j,a,b;char str[1000][1000];scanf("%d",&n);a=b=n;for(i=0;i<n;i++){for(j=0;j<2*n-1;j++){if(j==a||j==b){printf("*");a--;b++;} else printf(" ");} printf("\\n");} 这是上半部分,下半部分a++;b--;不知是否明白?

#include<stdio.h>
最后那个数组是9个字符,如果要正确定义,应该定义为:char diamond[][9] = {...};

用C语言编写一个输出图形的小程序。
法1:include <stdio.h> include<conio.h> void main(){ int i,j;for(i=0;i<4;i++){ for(j=1;j<4-i;j++)printf(" ");for(j=4-i;j<=4+i;j++)printf("*");printf("\\n");} for(i=4;i<7;i++){ for(j=0;j<i-3;j++)printf(" ");for(j=i-3;j<=9-i;j...

相似回答