Difference Between a Numeric Array and a String
Distinguish between numeric arrays and strings in this lesson.
We'll cover the following
A numeric array relies on the array length for traversal
While passing a numeric array to a function, we need to pass the base address of the array and the number of elements present in it.
While passing a string, we need to pass only the base address. This is possible because a string ends with a ‘\0’
, and the function receiving the base address can iterate through the string until it encounters a ‘\0’
.
functionName(arrayName, arraySize);
functionName(stringName);
Get hands-on with 1200+ tech skills courses.