[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Returnerin af at "string" array



On Wed, 7 Feb 2001, |GeO| wrote:

> Hejsa
> 
> Hvordan returnerer man et:
> 
> char streng[][]
> 
> Jeg har lavet et array af "strenge" som jeg gerne vil returnere, men
> bliver ved med at få denne fejl:
> 
> warning: assignment makes integer from pointer without a cast
> 
> Al hjælp vil blive værdsat =)
> 

Et lille program som retunere char** og udskriver det til stdout, håber det
hjælper.

-Kim



------------------------- CPROG ------------------------
#include <stdlib.h>
#include <stdio.h>

char *s[3] = {"en", "to", "tre"};

char ** retur(){
  printf("%x\n", s[1]);
  return s;
}

int main () {
  char **S;
  int i;

  for (i = 0; i < 3; i++)
    printf("%s\n", s[i]);

  S = retur();
  for (i = 0; i < 3; i++)
    printf("%s\n", S[i]);

  return 0;
}

------------------------- CPROG ------------------------





 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *