This tip shows you how to calculate the length or number of elements in a one-dimensional array by using the sizeof function. To find the length or number of array elements in C, you can use this syntax :
The example code below calculates the lengths of integer, double, and string arrays.
//calculate array length
printf("First Array length=%d\n",array_length);
printf("Second Array length=%d\n",array_length);
printf("Third Array length=%d\n",array_length);
Posted by: Lavy | post date: 01-26-2013 | Subject: C Programming Language
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: