desaster0505
Erfahrenes Mitglied
Hallo!
Probiere hier ein kleines Programm unter Linux
Aber folgende Fehler erscheint beim compilieren mit g++ und ich weiss nicht wieso "n" kein Typ sein soll?!
»n« is not a type
Vielleicht könnt ihr mir helfen
Probiere hier ein kleines Programm unter Linux
C++:
#include <iostream>
#include <cstring>
using namespace std;
int n;
char string1[20], string2[20];
void stringCopy(char *ziel, char *quelle){
strcpy(ziel, quelle);
}
void stringCopy(char *ziel, char *quelle, n){
strncpy(ziel, quelle, n);
}
int main(){
stringCopy(string1, "Hallo Welt");
stringCopy(string2, string1, 5);
cout << string1 << endl;
cout << string2;
return 0;
}
Aber folgende Fehler erscheint beim compilieren mit g++ und ich weiss nicht wieso "n" kein Typ sein soll?!
»n« is not a type
Vielleicht könnt ihr mir helfen