Computing.Net > Forums > Programming > Arrays in C-variable declaration???

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Arrays in C-variable declaration???

Reply to Message Icon

Name: Dado
Date: November 22, 2003 at 16:21:28 Pacific
OS: Me
CPU/Ram: 512MB
Comment:

I would like to know how to declare variables for arrays when the size of the array is not known, thus it is event- controlled (ex. sentinel vaue of 0) . For example: int array1[4] declares a one dimensional array variable for holding integer values for array1 of 4 things. How can I declare this if I did not know the number of objects and needed to use sentinel values to stop the reading and define the size? Help is appreciated!



Sponsored Link
Ads by Google

Response Number 1
Name: Sajid Mohammed
Date: November 22, 2003 at 17:24:19 Pacific
Reply:

Did you try using Dynamic allocation of memory ? The function name is "malloc" and use "man malloc" on unix to know more about the function.

Sajid Mohammed
sajidspace@yahoo.com
http://www.cs.uml.edu/~smohamme


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Arrays in C-variable declaration???

How to use string array in C++? www.computing.net/answers/programming/how-to-use-string-array-in-c/9478.html

vector of arrays in c++ www.computing.net/answers/programming/vector-of-arrays-in-c/12919.html

Dynamic Arrays in C www.computing.net/answers/programming/dynamic-arrays-in-c/3396.html