Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Question

Brand new to C and Code Blocks

Apr 21, 2020 12:32PM PDT

Just starting out w/ C (not C++). I want to create many small pgms and test as I go along in my textbook. Can I create these pgms under 1 project and just execute the ones I want, independent of each other? I ask because I created 2 pgms in 1 project but the very 1st pgm always executes, even though I am asking for (and looking at) the 2nd one. Thank you for any help!

Discussion is locked

- Collapse -
Answer
Re: C
Apr 21, 2020 12:46PM PDT

That really depends on your IDE (Integrated Development Environment). That defines what a project is and what is the main program (the module that calls all other modules) that runs.

Back when C was invented all sources were just files in folders in what's now in Windows 10 is called File Explorer or maybe just files in directories in MS-DOS. No such thing as IDE's and projects.

- Collapse -
C in Code Blocks
Apr 21, 2020 5:11PM PDT

IDE - I think its Code Blocks. In C.B. it looks like I must have a pgm in a project to get anywhere (am I wrong?). What I see in C.B. is this (having trouble w/ the link):

Workspace
  MYTEMP     (plan...)
   Source
     ch2ex3    (pgm1...)
     ch2ex4    (pgm2...)

ch2ex3 executes every single time, regardless of what I pick. Have tried a lot of combinations but cannot the pgm2 to execute. Once I do, the rest should be EZ.
Are you knowledgeable enough in C.B. to tell me what I am doing wrong? TKS.

- Collapse -
Stop.
Apr 21, 2020 6:45PM PDT

Create a project for each app. I decline to go any further why you can't do what you want outside of a class environment.