Illegal use of pointer

thanks for seeing my post, im beginer here
I have a code : for write
*
**
***
****
*****
this code :
-------------------------------
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>

void main()
{
//clrscr();
int r1,s2,s1;
r1=10;
s1=10+ ++r1;
//s2=10+ r1++;
cout << "nilai r1 = "<<r1<< "\n";
//cout <<"Nilai s2 dengan r1++ = "<<s2<< "\n";
cout <<"Nilai s1 dengan ++r1 = "<<s1;

///cout << " rata-rata = " <<angka1;
getch();
}
----------------------------------------------
but it have error 9: Illegal use of pointer.
thanks
Please in the future use code tags.

I don't see where that error could be coming from.... but I do see two errors:
1. iostream and iomanip should not have the .h extension
2. you either need to preceed cout with the scope std (as in std::cout) or you need to add the statement using namespace std; before your main method.

Non errors that are bad coding practice:
1. main should not be void, it should return int
2. instead of using getch() to pause your program, you should use something else like cin or getline, there is a whole topic about this here http://cplusplus.com/forum/beginner/1988/

Hope this fixes your issue.
Last edited on
Topic archived. No new replies allowed.