1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C programme pls help

Discussion in 'C' started by gatzos_barca, Dec 5, 2007.

  1. gatzos_barca

    gatzos_barca New Member

    Joined:
    Dec 5, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello All,

    I just want to ask what this programme does. Actually i know what it does, i just wanna know the exact operation of it.
    Code:
                  char *u ;		//declare the string
                  char k;
                  unsigned int x; // declare integer
                  int i;      
                  u = " University " ;
                  k = u[0];
                  
    ASC0_uwGetData() ;		//wait to get data
    x = ASC0_uwGetData() ;	//get character to the variable
    
               if(x=='u')
    
     {
      	for(i=0;k!=0; i++)		// Read-dynamic way
    		{
    
    		k =u[i] ;
    		while(ASC0_ubTxBufFree() == 0) {}	//wait untill buffer is not busy
    		ASC0_vSendData(k);	//send Data
    
    		}
     }

    OK what i dont get is the for loop. what does it do exactly with the string(z=p)? Is it trying to read the word using the dynamic way? How does it do that? :confused:
    The programme is supposed to read the u character when its pressed from the keyboard and the extract the word university.. I know its very simple but i'm a beginner...so pls help me!!!! :(
     
    Last edited by a moderator: Dec 5, 2007
  2. Salem

    Salem New Member

    Joined:
    Nov 15, 2007
    Messages:
    133
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Please don't PM me for 1:1 support.
    The loop reads the word, one letter at a time, until it reaches the end of the word.
     

Share This Page