What does * mean in C programming?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

What does * mean in C programming?

ソリューションへジャンプ
11,695件の閲覧回数
admin
Specialist II

Hi. Below is a code to write characters to a LCD display. I would like to know what does the * mean. Thx

 

void lcd_string(byte line,byte *_data_buffer)
  {
     byte i;
     __RESET_WATCHDOG();
     if(line==1)
      {
        lcd_write_cmd(0x40); //DDRAM
        Check_LCD_Busy();//
        lcd_write_cmd(0x80); //CGRAM
        Check_LCD_Busy();
      }
      else
      {
        //lcd_write_cmd(0); //DDRAM
        lcd_write_cmd(60); //DDRAM
        Check_LCD_Busy();//
 
        lcd_write_cmd(0xc0); //CGRAM
        Check_LCD_Busy();//while((lcd_read_cmd()&0x80)==0x80);
      }
      
    for(i=0;i<LCD_16X2;i++)
    {
      if(_data_buffer[i]!=0)
      {
        lcd_write_data(_data_buffer[i]);
        Check_LCD_Busy();
      } else break;  
    }
  }

Message Edited by Cryptical on 2009-02-26 06:44 AM
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
2,774件の閲覧回数
bigmac
Specialist III

Hello,

 

The following is an example of using the function -

 

const byte str1[] = "The quick brown fox";

const byte str2[] = ...

 

...

 

void main(void)

{

 

...

lcd_string(1, str1);

 

The value of str1 is a pointer to the first element (character) of the array str1[].

 

Regards,

Mac

 

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
2,774件の閲覧回数
PEBeginnerBeh
Contributor I
Yes, so the programm works.
0 件の賞賛
返信
2,774件の閲覧回数
admin
Specialist II

Thx for the reply. So i think the program above means writing a character to the first space of the LCD, and then points to the next space and repeats the process.

0 件の賞賛
返信
2,774件の閲覧回数
PEBeginnerBeh
Contributor I

Hi

 

I think  byte *_data_buffer defines a pointer wich has the range of a byte. * mean that the follow variable is define or use (for use it must be define befor) as a pointer.

Example:

 

char *test defines a pointer test with a rang from 0 to 255.

 

Message Edited by PEBeginner on 2009-02-26 09:25 AM
0 件の賞賛
返信
2,775件の閲覧回数
bigmac
Specialist III

Hello,

 

The following is an example of using the function -

 

const byte str1[] = "The quick brown fox";

const byte str2[] = ...

 

...

 

void main(void)

{

 

...

lcd_string(1, str1);

 

The value of str1 is a pointer to the first element (character) of the array str1[].

 

Regards,

Mac

 

0 件の賞賛
返信