SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Feb 22, 2009, 09:18 #1
- 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
-
Feb 22, 2009, 09:19 #2
- 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]
-
Feb 23, 2009, 05:28 #3
- 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?
-
Feb 23, 2009, 11:32 #4
- 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/
-
Feb 23, 2009, 23:55 #5
- Join Date
- Nov 2008
- Location
- Bombay
- Posts
- 152
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Feb 25, 2009, 06:56 #6
- 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.
Max Says...
http://maxmanders.co.uk
Bookmarks