473,386 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How To Fix A Illegal Use Pointer ?

2
#include<iostream.h>
int main()
{
char *nama_siswa;
int nilai_1;
int nilai_2;
int rata_rata;
char *phi;
int r;
int luas;

nama_siswa="Andi";
nilai_1= 84;
nilai_2= 88;
rata_rata= 86;
phi="3,14";
r=14;
luas=phi*r*r;

cout<<"Nama Siswa = ";
cout<<nama_siswa;
cout<<endl;
cout<<"Nilai 1 = ";
cout<<nilai_1;
cout<<endl;
cout<<"Nilai 2 = ";
cout<<nilai_2;
cout<<endl;
cout<<"Rata-Rata = ";
cout<<rata_rata;
cout<<endl;
cout<<endl;
cout<<"Phi = ";
cout<<phi;
cout<<endl;
cout<<"R = ";
cout<<r;
cout<<endl;
cout<<"Luas = ";
cout<<luas;
cout<<endl;
}
Sep 27 '15 #1
2 1261
weaknessforcats
9,208 Expert Mod 8TB
This code:

Expand|Select|Wrap|Line Numbers
  1. luas=phi*r*r;
  2.  
phi is a pointer r is an int. A pointer times an int is what? a pointer? an int? The compiler won't guess.

Here's my guess but I could be wrong since I haven't examined the code in detail.
Expand|Select|Wrap|Line Numbers
  1. luas =(* phi)*r*r;
Sep 27 '15 #2
You are absolutely right Sir!
Sep 29 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Andreas Schmidt | last post by:
I am trying to understand the behavior of void pointers. Can someone explain to me why I get a segfault for the following program? #include <stdio.h> void* plusone(void* i){ int* arg =...
0
by: Bruno van Dooren | last post by:
Hi, I am debugging a dll that is used in an application that calls all functions with C calling conventions, and cannot handle exceptions. Every 1-2 months there is a crash due to an unhandled...
21
by: Roman Werpachowski | last post by:
I can't understand this: double * x = new double; const double * p = x; delete p; works. Why am I allowed to delete a const pointer? On the same note: why am I allowed to do this: class...
9
by: Roshni | last post by:
Hi, I wanted to know how do function pointers sometime access illegal memory access ? Could any one give me an example ? Thanks, Roshni
30
by: Joe Smith | last post by:
A recent post of mine showed a sufficiently large gaffe on pointers as to need to return to K&R 5.1-6 appendix A8.6.1 . So we have type specifiers: int long .. One dreams himself variable...
11
by: asdf | last post by:
C++ allows a reference to a pointer, but doesn't allow a pointer to a reference, why?
11
by: Christopher Key | last post by:
Hello, Can anyone suggest why gcc (-W -Wall) complains, test.c:22: warning: passing arg 1 of `f' from incompatible pointer type when compiling the following code? Change the declation of f...
26
by: =?iso-8859-1?q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
Do you think we can reach any kind of consensus on whether the following code's behaviour is undefined by the Standard? int my_array; int const *const pend = *(&my_array + 1); Considering...
18
by: Richard Eich | last post by:
I need a clue. I'm getting an "invalid lvalue in increment" from gcc 4.1.2 on this line... sum += *((unsigned short *)iphp)++ ; ....but I don't see what the problem is. gcc 3.4.3 isn't...
2
by: noorhidayah | last post by:
Hi everyone. I'm stucked in the middle of my programming. I'm trying to read data form the file, and then create the classes as well as feature vector format for that data. E.g my data: 9.8776757 and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.