• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Character Array in C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Character Array in C
      • From: Michael <email@hidden>
    • Re: Character Array in C
      • From: Lawrence Gold <email@hidden>
    • Re: Character Array in C
      • From: Rick Mann <email@hidden>
References: 
 >Character Array in C (From: Michael <email@hidden>)

  • Prev by Date: Character Array in C
  • Next by Date: Re: Character Array in C
  • Previous by thread: Character Array in C
  • Next by thread: Re: Character Array in C
  • Index(es):
    • Date
    • Thread