Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - How to reset char to null?

How to reset char to null?

Discuss PocketC for CE (including Desktop Edition)

Postby Sharpie on Sat Feb 10, 2001 12:37 pm

How do you reset a char value to nothing?
for example, I have a char variable "test" whose value is 'n'.
When I then say next='';
to reset that to nothing,
I get a compiler error.
Sharpie
 
Posts: 3
Joined: Sat Feb 10, 2001 12:32 pm

Postby ianf on Sat Feb 10, 2001 12:47 pm

If you post appears correctly then your line next ="; has an error as there should be two double quotes and not one eg:
next = "";
because you are saying that the contents of n is the literal value of "nothing" you need to start and end the literal
ianf
 
Posts: 92
Joined: Mon Dec 11, 2000 7:25 am
Location: United Kingdom

Postby Sharpie on Sat Feb 10, 2001 1:44 pm

Actually it appears wrong, what I was putting was two single quotes. I understand that to set the value of a char variable, one uses single quotes ( like: test = ' value ' ) as opposed to the double quotes used for a string.
Sharpie
 
Posts: 3
Joined: Sat Feb 10, 2001 12:32 pm

Postby airdrik on Sat Feb 10, 2001 6:29 pm

What you can do is exparament on a new program just setting it to different null values and see what you get (ie. (char)0, "", c=c-c;<img src=icon_smile.gif border=0 align=middle>, etc.)
And pick the best one.
airdrik
 
Posts: 26
Joined: Fri Feb 09, 2001 3:25 pm

Postby Sharpie on Sat Feb 10, 2001 7:22 pm

Yep, you're probably right.
If I use "", it compiles, but doesn't work right. I though about trying n=n-n, but didn't actually try it. I will though.
Sharpie
 
Posts: 3
Joined: Sat Feb 10, 2001 12:32 pm

Postby Justinespinosa on Sun Feb 11, 2001 8:42 am

No need to think. The Charcter 0 is null, 31 is space 27 is ESC, etc... so if you create:

char c;

then do c='a'

the value of c will be 97, i think. If you puts( (int)c ), you will see it.

so just write c = 0, if c is a string c will be "0", but if it's a char, c will be null.


J.Espinosa

OUTS Softwares
J.Espinosa

OUTS Softwares
Justinespinosa
 
Posts: 156
Joined: Wed Dec 06, 2000 2:30 pm
Location: Switzerland

Postby guy on Tue Feb 13, 2001 8:20 am

If you want to set a char to the null character then set it to '\0' (thats a zero)

char c ;

c = '\0' ;


If you want to set a string to a null string then set it to ""

string s ;

s = "" ;



Guy
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom


Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 3 guests

cron