Thread: What is happening here PLZ help me

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    10

    What is happening here PLZ help me

    Hi all,
    this is very simple program but I am not getting why it is behaving like this. The second loop is not working as I expected whats wrong in that.

    Code:
     
    
    int main()
     {
         int i,j=5;
         Xuint8  data[i];   
         Xuint32 * const customLogicPtr = (Xuint32 *)0x84018000;//bram base 
       
         print("Enter the desired number\r\n");
       
       for(i=0;i<5;i++)
       {
           data[i] =  XUartLite_RecvByte(0x84000000); 
           *(customLogicPtr+i) = data[i];
         
           xil_printf("%c,%x\r\r\n",*(customLogicPtr+i),customLogicPtr+i);
         
       }
    
        print (" This is the temporary register...\r\n");
    
        while (j)
        {
            j--;
            xil_printf("%c,%x\r\r\n",*(customLogicPtr+j),customLogicPtr+j);
        }
    
           return 0;       
     }
    This program's expected o/p is

    Enter the desired number
    1,84018000
    2,84018004
    3,84018008
    4,8401800C
    5,84018010

    This is the temporary register...
    5,84018010
    4,8401800C
    3,84018008
    2,84018004
    1,84018000


    But I am getting
    Enter the desired number
    1,84018000
    2,84018004
    3,84018008
    4,8401800C
    5,84018010

    This is the temporary register...
    1,84018010 /* why it printing value 1 at this address
    4,8401800C
    5,84018008 /* here aswell*/
    2,84018004
    1,84018000


    Thanks in advance
    Last edited by jayee_spicyguy; 11-15-2008 at 06:23 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any1 plz make this assignment
    By jean in forum C Programming
    Replies: 17
    Last Post: 05-13-2009, 09:19 PM
  2. [Request] Need Help Plz
    By TylerD in forum Tech Board
    Replies: 4
    Last Post: 01-03-2009, 09:54 AM
  3. Anyone plz help me
    By Rose_Flowers in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 09-17-2003, 12:01 PM
  4. plz help me fix this problem
    By Joe100 in forum C++ Programming
    Replies: 8
    Last Post: 07-13-2003, 01:25 PM
  5. help plz plz
    By nsssn73 in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2002, 08:44 AM

Tags for this Thread