I have this bit of code, which I created to store the length of each argument in a dynamically created array:
int *inputStrLen; inputStrLen = malloc(argc * sizeof(int));
I am just wondering if I am misunderstanding how this works. Does it actually create a new array?
The program works perfectly as far as I can tell. And I ran tests with code like this to display the length of each argument, and it works fine.
// this is what would be entered in command prompt c:\blahblah\programs\> stringrev brian no // this is the code to test them printf("Length: %d ", inputStrLen); printf("Length: %d ", inputStrLen); // this is the ouput Length: 5 Length: 2
Sorry if this is a dumb question, but I'm only familiar really with the "new" operator in C++ with which one may unambiguously create a new array.