working with STRPTR

5 posts / 0 new
Last post
tekmage
tekmage's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-10-09 03:19
working with STRPTR
Hi All, I wanted to share a little bit of knowledge I figured out. I could be silly for even posting this but I've been playing around with C, creating several projects for fun. When working with strings I had been using: STRPTR = "Insert Text here"; But this will throw a compiler error: app.c:###: warning: initialization discards qualifiers from pointer target type What I learned is the right way to do this is to use CONST_STRPTR = "Insert Text here"; If your a newbie like me this might help if you need to create any string constances in your projects. Cheers, Bill "tekmage" Borsari
cha05e90
cha05e90's picture
Offline
Last seen: 2 years 10 months ago
Joined: 2011-02-07 20:22
And - as always - it helps to
And - as always - it helps to have no typos in your code! (Spotted, anyone?) :-) Nevertheless I'm a C newbie as well, so any tips like this are very helpful and welcome! Thanks!
X1000|II/G4|440ep|2000/060|2000/040|1000
afxgroup
afxgroup's picture
Offline
Last seen: 4 months 9 hours ago
Joined: 2011-02-03 15:26
STRPRT but maybe is only a
STRPRT but maybe is only a typo..
tekmage
tekmage's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-10-09 03:19
Thanks! fixed that bug and
Thanks! fixed that bug and added line termination ;)
LyleHaze
LyleHaze's picture
Offline
Last seen: 1 year 6 months ago
Joined: 2011-05-26 03:58
Nice. Don't we usually add a
Nice. Don't we usually add a name when declaring variables/constants? CONST_STRPTR mytext = "Insert Text here"; Otherwise it's hard to make references to it later. Merry Christmas :)
LyleHaze
Log in or register to post comments