To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 7041
7040  |  7042
Subject: 
Re: Character Arrays
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 5 Nov 1999 02:30:47 GMT
Viewed: 
1014 times
  
You're initializing foo[] wrong, it should be:
char foo[] = { '1', '2', '3', '4' );

In lugnet.robotics.handyboard, Clay Harmony writes:
Hi...

I'm wondering if there's a way to extract an element from a character array • the
same way it would be done for an integer array.

For example, when I have:

char foo[]= {1, 2, 3, 4};

char bar(int i)
{
return foo[i];
}

... a zero is returned for each element of the array.  However, if I change
"char" to "int" above, the correct values are returned.

Am I doing something wrong, or is this an IC(v3.1) thing?

thanks,
clay.



Message is in Reply To:
  Character Arrays
 
Hi... I'm wondering if there's a way to extract an element from a character array the same way it would be done for an integer array. For example, when I have: char foo[]= {1, 2, 3, 4}; char bar(int i) { return foo[i]; } ... a zero is returned for (...) (25 years ago, 5-Nov-99, to lugnet.robotics.handyboard)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR