Learnem Educational
May 18, 2012, 12:56:50 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Indirection?  (Read 2290 times)
Randy
Newbie
*
Posts: 11


View Profile WWW
« on: August 15, 2002, 04:24:19 PM »

I get an error when I try to compile my program. It says that "Indirection must be through a pointer". I have not a clue as to what that means. The code:

[code:3t00n8nz]#include <stdio.h>

#define PI 3.1415

main()
{
   float radius, area;

   printf("Enter the radius:\n");
   scanf("%1f", &radius);

   area = PI * radius ** 2;
   printf("Area of circle with radius %f is: ", radius, area);
}

[/code:3t00n8nz]

Operating system is HP-UX 10.20. Thanks In Advance.
« Last Edit: January 01, 1970, 12:00:00 AM by Randy » Logged
Anonymous
Guest
« Reply #1 on: August 16, 2002, 12:41:46 AM »

area = PI * radius * 2; /*delete the extra * and try again.  If thats correct then good but if not email me back and we'll try again*/
 :D
« Last Edit: January 01, 1970, 12:00:00 AM by Anonymous » Logged
Randy
Newbie
*
Posts: 11


View Profile WWW
« Reply #2 on: August 16, 2002, 11:38:11 AM »

The formula for area is PI times the radius squared. If I knock off the extra '*', wouldn't that just denote simple multiplication rather than exponentiation? Thanks for the reply. :)
« Last Edit: January 01, 1970, 12:00:00 AM by Randy » Logged
Anonymous
Guest
« Reply #3 on: August 16, 2002, 09:44:50 PM »

[quote:4mia8x59]If I knock off the extra '*', wouldn't that just denote simple multiplication rather than exponentiation? Thanks for the reply. :)[/quote]

your right!  It would be more like PI * (rad * rad)

What your saying is PI * rad* * 2; not right because the complier thinks its a *p=pointer
 :lol:
« Last Edit: January 01, 1970, 12:00:00 AM by Anonymous » Logged
Mr. Cool
Newbie
*
Posts: 11


View Profile
« Reply #4 on: August 16, 2002, 10:11:38 PM »

[quote:ymketm1m]It would be more like PI * (rad * rad)
[/quote]
I believe thats right too
« Last Edit: January 01, 1970, 12:00:00 AM by Mr. Cool » Logged
Randy
Newbie
*
Posts: 11


View Profile WWW
« Reply #5 on: August 19, 2002, 12:02:18 PM »

OK, thanks. I changed it. I know nothing of pointers just yet. :)
« Last Edit: January 01, 1970, 12:00:00 AM by Randy » Logged
Anonymous
Guest
« Reply #6 on: August 21, 2002, 02:03:32 PM »

[quote:3vxbwxt0]I know nothing of pointers just yet. :)[/quote]
Try this website to learn more. type in c progranmming at [/url]www.howstuffworks.com " target="_blank">http://Have a wonderful day :lol:
« Last Edit: January 01, 1970, 12:00:00 AM by Anonymous » Logged
Randy
Newbie
*
Posts: 11


View Profile WWW
« Reply #7 on: August 22, 2002, 01:54:19 PM »

Thanks, I'll check it out. I am reading K&R right now, but it's kind of dense for a tutorial. ;)
« Last Edit: January 01, 1970, 12:00:00 AM by Randy » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!