Thread: devc++

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    25

    devc++

    I wrote this program and it compiles alright but when I try to run it the screen comes up and ask for dia. then I input dia. and a message comes up saying that this program has preformed an illegal operation. Can ne1 help me

    #include <stdio.h>

    int main()

    {

    int num1, sum, dia;

    printf ( "Enter the radius of the circle and\n" );
    printf ( "it will tell u the diamenter\n" );
    scanf ("%d, %num1" );
    sum = 2 * num1;
    printf ( "dia is %d\n", dia );

    return 0;

    }

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Code:
    scanf ("%d, %num1" );
    Learn how to use scanf

    Code:
    printf ( "dia is %d\n", dia );
    Where do you set dia?

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    25
    I am trying to learn how to use scanf just got into this C programing class and am learning what did I do wrong

  4. #4
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807

    ...

    Instead:
    Code:
    scanf("%d",%num);
    Write:
    Code:
    scanf("%d",&num);
    You'll learn about the & operator, when you'll start to deal with pointers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I want to draw a mandelbrot set ..
    By mad_muppet in forum C Programming
    Replies: 16
    Last Post: 08-18-2006, 12:43 AM
  2. DevC specivic... I think
    By QuestionC in forum Windows Programming
    Replies: 1
    Last Post: 01-09-2002, 04:04 PM