lgS öGRENCiSiDetux
Hectopat
- Katılım
- 27 Nisan 2022
- Mesajlar
- 1.768
- Çözümler
- 15
Aslında C++ ile pek uğraşmazdım ama lazım oldu. Birkaç pointer denemesi yapayım demiştim. Sonuç bu:
Hata:
Kodlar:
main.cpp:
dscriptcore.h:
Hata:
Kod:
In file included from main.cpp:2:0:
dscriptcore.h:4:38: error: declaration of 'getinput' as array of functions.
char getinput [] (char* inputtext)
^
dscriptcore.h:6:9: error: expected primary-expression before 'return'.
return *inputtext;
^~~~~~
dscriptcore.h:6:9: error: expected '}' before 'return'.
dscriptcore.h:7:5: error: expected declaration before '}' token.
}
Kodlar:
main.cpp:
C++:
#include <iostream>
#include "dscriptcore.h"
using namespace std;
int main ()
{
char text [] = "abc";
getinput(&text);
}
dscriptcore.h:
C++:
#include <iostream>
using namespace std;
char getinput [] (char* inputtext)
{
return *inputtext;
}