Ausgabe des Programms?
Wer von euch kann mir sagen was folgendes Programm ausgibt.Mein Compiler weigert sich es zu compilieren!Wer kann mir erklären was **s2 (bei Methode func)bedeutet(Pointer auf einen Pointer ?)
#include <stdio.h>
#include <stdlib.h>
void func (char *s1, char **s2, int *z1, int z2);
int main (int argc, char **argv)
{
char *ptr, *list1, *list2;
int i, anz, *zahl;
anz = (int) strtol (argv[1], &ptr, 10);
list1=malloc ((anz+1) * sizeof(char));
list2=malloc ((anz+1) * sizeof(char));
for (i=0;i<anz; i++)
{
list1[i] = *argv[i+2];
list2[anz-i-1] = *argv[i+2];
}
list1[anz]='\0';
list2[anz]='\0';
zahl=&i;
(void) printf ("Liste1: %s, Liste 2: %s, Zahl: %i, Anz: %i\n", list1, list2, *zahl, anz);
func (list1, &list2, zahl, anz);
(void) printf ("Liste1: %s, Liste 2: %s, Zahl: %i, Anz: %i\n", list1, list2, *zahl, anz);
exit (0);
}
void func(char *s1, char **s2, int *z1, int z2)
{
static int wortLaenge = 5;
static char *wort = "Dream";
s1 = wort;
*s2 = wort;
*z1 = wortLaenge;
z2 = wortLaenge;
}
|