What does * mean in C programming?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

What does * mean in C programming?

跳至解决方案
11,764 次查看
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,843 次查看
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,843 次查看
PEBeginnerBeh
Contributor I
Yes, so the programm works.
0 项奖励
回复
2,843 次查看
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,843 次查看
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,844 次查看
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 项奖励
回复