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

Changing the value of a passed variable

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



Joined: 31 Dec 2010
Posts: 36

View user's profile Send private message

Changing the value of a passed variable
PostPosted: Wed Oct 05, 2011 11:33 am     Reply with quote

I've used the following in another system but it's not working in CCS. Why isn't max_counter changed to 10?

Code:
#include <18F4550.h>
#device ICD=TRUE

#fuses HSPLL,PLL4,NOLVP,NOWDT,PUT,ICSP1

#use delay (clock=20000000)

#use RS232(DEBUGGER)


int max_counter;

void foo(int *num)
{
   *num = 10;
}

void main()   
{
   
   max_counter = 1;
   foo( max_counter );

   printf("MAX COUNTER = %d",max_counter);
   
   while (TRUE) 
   {
       
   }
}
newguy



Joined: 24 Jun 2004
Posts: 1901

View user's profile Send private message

Re: Changing the value of a passed variable
PostPosted: Wed Oct 05, 2011 11:46 am     Reply with quote

pebbert9 wrote:
I've used the following in another system but it's not working in CCS. Why isn't max_counter changed to 10?

Code:
#include <18F4550.h>
#device ICD=TRUE

#fuses HSPLL,PLL4,NOLVP,NOWDT,PUT,ICSP1

#use delay (clock=20000000)

#use RS232(DEBUGGER)


int max_counter;

void foo(int *num)
{
   *num = 10;
}

void main()   
{
   
   max_counter = 1;
   foo( max_counter );

   printf("MAX COUNTER = %d",max_counter);
   
   while (TRUE) 
   {
       
   }
}


Try:

Code:
foo(&max_counter);
pebbert9



Joined: 31 Dec 2010
Posts: 36

View user's profile Send private message

PostPosted: Wed Oct 05, 2011 12:10 pm     Reply with quote

thank you
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