SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot quantum physics's Avatar
    Join Date
    Nov 2008
    Location
    Bombay
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need a little breifing on Sub-scripts.

    Can some one please explain to me how sub-scripts in C work?
    please I really need to know How sub-scripts work.

    any help will really be helpful

  2. #2
    SitePoint Zealot quantum physics's Avatar
    Join Date
    Nov 2008
    Location
    Bombay
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Example of a Sub-script

    Char a[50]
    Int i

    a[i]

  3. #3
    SitePoint Zealot quantum physics's Avatar
    Join Date
    Nov 2008
    Location
    Bombay
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can any of the webmasters please help me on this one please?

  4. #4
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Location
    Moon Base Alpha
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are plenty of forums dedicated to C that can probably answer your question. I don't know C so I am not going to try and answer the question.

    http://bytes.com/topic/c/

  5. #5
    SitePoint Zealot quantum physics's Avatar
    Join Date
    Nov 2008
    Location
    Bombay
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by KevinR View Post
    There are plenty of forums dedicated to C that can probably answer your question. I don't know C so I am not going to try and answer the question.

    http://bytes.com/topic/c/
    Well,thanks anyway.

  6. #6
    SitePoint Addict mmanders's Avatar
    Join Date
    Jul 2006
    Location
    Edinburgh, Scotland
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In C, an array (i.e. a variable you index into with a subscript) is actually a more complicated data structure than a primitive variable. An int for example contains the value of an integer. However, an array variable, say theArray, is actually a pointer to the first memory address of the array. When you index into the array, you are conceptually saying go to the memory address of theArray, and move up N locations, where N is your index, and retrieve the value at that address. This is why if you index to a non-existent location in your array you will get a segmentation fault or similar, because the memory location doesn't have any data in it, or it is a null pointer.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •