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 CCS Technical Support

Making string functions...

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



Joined: 15 Aug 2005
Posts: 18

View user's profile Send private message

Making string functions...
PostPosted: Wed Nov 16, 2005 12:49 pm     Reply with quote

I'm having trouble making string functions.

For example:

Code:
printf("hello world");


works just fine... But I want to make my own string functions...

Code:

void MyStringFunc(string s){  // instead of string, i could use type char *s[]
// do something with strign here
}

main(){
MyStringFunc("Hello world");
}


But that doesn't work. I get errors about cannot make a pointer to a constant. How come you can pass a constant "hello world" to printf but not to my own function? How can I define a function to accept a "string" in the function call?

Thanks,
Sal
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Nov 16, 2005 12:57 pm     Reply with quote

CCS is not ansi C. We have no pointers to const.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 16, 2005 1:08 pm     Reply with quote

Quote:
I'm having trouble making string functions

See the example near the end of the following thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=22207
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