Society of Robots - Robot Forum

Software => Software => Topic started by: vipulan12 on February 16, 2013, 12:29:03 PM

Title: Problem with simple eclipse program
Post by: vipulan12 on February 16, 2013, 12:29:03 PM
hey guys i am trying to learn c using eclipse and after installing the cygwin

I tried this program:

/*
 ============================================================================
 Name        : HelloworldC.c
 Author      :
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

int pop=1;

int main(void)
{

   printf(pop);
   return EXIT_SUCCESS;
}

when i compile and run the program i get this error:

1 [main] HelloworldC 4692 exception::handle: Exception: STATUS_ACCESS_VIOLATION
830 [main] HelloworldC 4692 open_stackdumpfile: Dumping stack trace to HelloworldC.exe.stackdump


i don't know if my code is wrong or if i did something wrong with setting up the compiler(i looked through lots of tutorials to set it up)

Obviously I am a complete newbie so you have any suggestions try to explain it so that I could get it
I have done some Turing and ready to program Java but nothing super complicated
so please any advice is appreciated 
Title: Re: Problem with simple eclipse program
Post by: briselec on February 16, 2013, 03:13:57 PM
You should have got warnings when you compiled it because that's not how you use printf.
Should be -  printf("%d", pop);
Title: Re: Problem with simple eclipse program
Post by: vipulan12 on February 16, 2013, 04:37:33 PM
what is the %d for
Title: Re: Problem with simple eclipse program
Post by: vipulan12 on February 16, 2013, 04:51:20 PM
Thanks that made it work