Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   C programme pls help (http://www.go4expert.com/forums/c-programme-pls-help-t7711/)

gatzos_barca 5Dec2007 06:33

C programme pls help
 
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? :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!!!! :(

Salem 5Dec2007 12:25

Re: C programme pls help
 
The loop reads the word, one letter at a time, until it reaches the end of the word.


All times are GMT +5.5. The time now is 00:02.