Pointers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • priyanksmith
    New Member
    • Dec 2015
    • 5

    Pointers

    I am new to C...

    #define block_size 16 // data block size

    typedef int int32;
    typedef int32 block[block_size];

    block MX_INP[6] ;
    block *IN_PNTR = MX_INP ;

    for(l=0;l<6;l++ )
    {
    for(i=0;i<16;i+ +)
    fscanf(FL_InPnt r, "%x", &IN_FL[i]);

    for(i=0; i<16; i++)
    {
    MX_INP[l][i] = IN_FL[i];
    }
    l++;

    here..does MX_INP[l][i] represents 1st element of 1st element of array?

    Please Help
    Thanks in advance
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    First read this: https://bytes.com/topic/c/insights/7...rrays-revealed

    especially the last example.

    Next, load some values in the array and step through with your debugger and see what you get.

    Post again if you still have questions.

    Comment

    • priyanksmith
      New Member
      • Dec 2015
      • 5

      #3
      thank you so much....
      wen i am trying to execute i am getting error saying debug assertion failed..Express ion!=NULL
      int retval=0;

      _VALIDATE_RETUR N((stream != NULL), EINVAL, EOF);
      _VALIDATE_RETUR N((format != NULL), EINVAL, EOF);

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Did you check that your stream pointer is not null?

        Like the fopen returned zero.

        Comment

        • priyanksmith
          New Member
          • Dec 2015
          • 5

          #5
          How do i do that? :-(

          Comment

          • priyanksmith
            New Member
            • Dec 2015
            • 5

            #6
            I checked...

            if (F_InPntr == NULL)
            {
            printf("not open\n");
            return -1 ;
            }
            else
            printf("File open\n");

            Mx_Pntr.exe: Native' has exited with code -1 (0xffffffff).

            File not open:(

            What do i do now?

            Thanks in advance

            Comment

            • donbock
              Recognized Expert Top Contributor
              • Mar 2008
              • 2427

              #7
              Did you use fopen to open the file?
              Did you open the file for reading?
              Are you sure the file exists?

              Comment

              Working...