CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

how to run program after first program

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nailuy



Joined: 21 Sep 2010
Posts: 159

View user's profile Send private message

how to run program after first program
PostPosted: Mon Sep 01, 2014 12:40 pm     Reply with quote

Hy
I want to run second program after first:
example

Code:
#int_CCP1
void ABCD()
{
//do something
if (a>1){/*do something*/;}
else {EFGH();}
}

void EFGH()
{
//do something
}


I receive undefined identifier error -- EFGH
Can somebody help me to make it work?
Best regards.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 01, 2014 1:16 pm     Reply with quote

Read about function prototypes.
http://coder-tronics.com/wp-content/uploads/2014/02/Function-breakdown.png
nailuy



Joined: 21 Sep 2010
Posts: 159

View user's profile Send private message

PostPosted: Tue Sep 02, 2014 1:04 pm     Reply with quote

Thank you.
I found solution
Code:
void EFGH();   // function declaration

void ABCD()
{
if (a>1){/*do something*/;}
else {EFGH();}   

}

void EFGH()    // function definition
{
}

This case may close.
Best regards.
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue Sep 02, 2014 1:20 pm     Reply with quote

Hi,

Another solution would be to simply move the EFGH() function above the ABCD() function. During compile, the EFGH() reference would have already be resolved by the compiler, so the 'Unidentified Error' problem would not be an issue. IOW, it's possible to structure a 'C' program entirely without 'Function Prototypes', but some may consider that poor form? Your mileage may vary!

John
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group