C programme pls help

gatzos_barca's Avatar, Join Date: Dec 2007
Newbie Member
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[i])? Is it trying to read the word using the dynamic way? How does it do that?
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 shabbir; 5Dec2007 at 09:29.. Reason: Code block
0
Salem's Avatar, Join Date: Nov 2007
Ambitious contributor
The loop reads the word, one letter at a time, until it reaches the end of the word.