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![]()
| SitePoint Sponsor |

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![]()

Example of a Sub-script
Char a[50]
Int i
a[i]

can any of the webmasters please help me on this one please?
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/



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.
Max Says...
http://maxmanders.co.uk
Bookmarks