<分区>
为什么gcc编译失败,vc6.0编译成功
gcc 版本 4.1.2 20070115 (SUSE Linux)
linux:~# cc t.c
t.c: In function ‘main’:
t.c:24: error: invalid use of non-lvalue array - printf((confFQDNtolower(&tFQDN)).strName);
代码:
#include <stdio.h>
#include <ctype.h>
typedef struct {
char strName[128];
unsigned short wLen;
}T_FQDN;
T_FQDN confFQDNtolower(T_FQDN *ptFQDN)
{
static T_FQDN tFQDN = {0};
int i;
tFQDN.wLen = ptFQDN->wLen;
for (i = 0; i < ptFQDN->wLen; i++)
{
tFQDN.strName[i] = tolower(ptFQDN->strName[i]);
}
return tFQDN;
}
int main()
{
T_FQDN tFQDN = {"a.B.c", 5};
printf((confFQDNtolower(&tFQDN)).strName);
return 0;
}