Software > Software

Problem with simple eclipse program

(1/1)

vipulan12:
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 

briselec:
You should have got warnings when you compiled it because that's not how you use printf.
Should be -  printf("%d", pop);

vipulan12:
what is the %d for

vipulan12:
Thanks that made it work

Navigation

[0] Message Index

Go to full version