EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Significance of * (star) in this program

Significance of * (star) in this program

|

Microcontroller › 8051 › Significance of * (star) in this program

  • This topic has 2 replies, 3 voices, and was last updated 12 years, 3 months ago by AJISH ALFRED.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • December 12, 2013 at 6:18 pm #2759
    Manu
    Participant

    void lcd_disp(unsigned char C)
    {
    LCD=C;
    LCD_RS=1;
    LCD_EN=1;
    delay_ms(1);
    LCD_EN=0;
    }
    void lcd_data(unsigned char *disp)
    {
    while(*disp)
    lcd_disp(*disp++);
    }

    This is a C program to display strings on LCD. I am not able to understand the significance of *(star) in this program. Please any one give the answer.

    December 13, 2013 at 5:45 am #10730
    shailesh
    Participant

    First of all you need a basic knowledge of C lang….

    by the way it is not star but is is called as a POINTER…..

     

     

    void lcd_data(unsigned char *disp)

    {

    while(*disp)

      lcd_disp(*disp++);

    }

     

     

    explanation..

     

     while(*disp) is conditional statament if Your character is not null ( ‘’ ) then and then lcd_disp(*disp++); executed and then due to Post increment Next address is came in pointer…and again while(*disp) condition check if it not null then display on lcd otherwise condition of loop is false and loop is terminated…

     

     

    So Pointer is gives You a address Of your Variables…

    Like wise

    Disp[8]=”SHAILESH” stored at 0x00H then

     

    *Disp will giive your a Address Of Disp[0] Not ‘S’;

     

     

     

     

    December 13, 2013 at 5:56 am #10731
    AJISH ALFRED
    Participant

    Hi Ganesh,

    Next time when you post the code, please don’t forget to format it in the proper way as I’ve done for you this time.

     

    void lcd_disp(unsigned char C) 
    {
          LCD=C; LCD_RS=1; LCD_EN=1;
          delay_ms(1);
          LCD_EN=0; 
    }
     
    void lcd_data(unsigned char *disp) 
    { 
         while(*disp) 
                lcd_disp(*disp++); 
    }
     
    The *disp is a pointer to an array that holds the character to be displayed. Initially it will point to the first charcter of the array and as you increase the pointer like (*disp++) it point to the succeeding characters.
     
    Is this code working?
     
    If you have any doubts, please feel free to post here.
  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • H bridge current direction logic March 11, 2026
  • LM741 alternatives? March 11, 2026
  • Very Curious Issue With DS3231 RTC Clock March 10, 2026
  • Distorted output from buffer March 10, 2026
  • Motor Getting Hot March 10, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise