Re: Character Array in C
Re: Character Array in C
- Subject: Re: Character Array in C
- From: Ben <email@hidden>
- Date: Mon, 3 Apr 2006 13:08:54 -0700 (PDT)
test(helloworld) returns void, and yet you are using it as if it would evaluate
to a char*.
On Mon, 3 Apr 2006, Michael wrote:
Could anyone please offer some advice:
Trying to play with character arrays in C, the code below generates this
error.
Anyone see something wrong?
thank you in advance.
#include <stdio.h>
void test(char s[]);
char helloworld[11];
int main () {
printf("%s", test(helloworld)); // <----Invalid use of void expression
return 0;
}
void test (char t[])
{
t[0]='H';
t[1]='e';
t[2]='l';
t[3]='l';
t[4]='o';
t[5]=' ';
t[6]='W';
t[7]='o';
t[8]='r';
t[9]='l';
t[10]='d';
t[11]='\0';
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden