answersLogoWhite

0


Best Answer

Yes, see the C99 ISO standard §6.5.2.1/2. Assuming a pointer "a" into an allocated array, a[-1] is equivalent to *(a - 1). Naturally, if (a - 1) points to an unallocated memory location, you get undefined behavior.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C allows an array index of both positive and negative integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

What number goes into 750?

The following are factors of 750, meaning they go into 750 a certain number of times. To find out how many times the number goes into 750, find the corresponding number on the other side of the array. For instance to see how many times 5 goes into 750, find the 4th-last number in the array (150):1, 2, 3, 5, 6, 10, 15, 25, 30, 50, 75, 125, 150, 250, 375, 750


A magic square is a square array of positive integers such that the sum of each row column and?

I recently studied a magic square. It is a square that when each row, diagonal, horizontally, or vertically is added up, it equals the same positive integer.


What happens if a subscript value is negative or higher than the number of elements in an array?

It cannot be part of the array.


What is the default value of the array elements in an integer array?

'0' Try this: public static void main(String[] args){ } The output would be 0 even though you did not initialize any value in the int array.


Write a function in java that accepts an array of integers and returns the second largest integer in the array Return -1 if there is no second largest?

Method 1: Sort the array in descending order, compare 1st and 2nd if not same , return 2nd if same return -1 Method 2: Find the largest number in the array, initialize another array with dimension 1 less than of original. Copy the array elements from the original array minus the largest element. not select largest from the second array and compare with the previous one if not same return the second largest if same return -1

Related questions

Why the index of an array be a positive number?

Since an array cannot contain a negative number of items, the size of an array must be at least 0. So if you ever tried to retrieve the element at a negative index in an array, it would automatically be understood to be out-of-bounds.


What number goes into 750?

The following are factors of 750, meaning they go into 750 a certain number of times. To find out how many times the number goes into 750, find the corresponding number on the other side of the array. For instance to see how many times 5 goes into 750, find the 4th-last number in the array (150):1, 2, 3, 5, 6, 10, 15, 25, 30, 50, 75, 125, 150, 250, 375, 750


What is the difference between a numericial array and an associative array?

A numericial array is an array with keys made up of only integers. An associative array is an array with keys made up of anything that is not an integer. In some languages, it is possible to mix integer keys and non-integer keys into a mixed array.


What is the negative prefix of array?

The negative prefix of "array" would be "non-".


What is integer type array?

An array is a collection of similar data types. An integer array is nothing but a collection of integer data types. Ex: int a[100], int arr[100][100] There are several types. 1D array, 2D array, Multi-Dimensional array. But array is a contiguous allocation. And array size will always be positive. It can be given in the declaration stage or we can specify it dynamically by using malloc function. Ex: int *a; a=(int*)malloc(sizeof(int)*HOW_MANY_NUMBERS_YOU_WANT);


What is the sie of an array whos upper bound is 100?

To calculate the size of array the type of array should be given. Ex: if it is of integer type that means int arr[100] and integer is of 4 bytes, then the size of array will be 400 bytes.


Difference between integer array and character array?

Arrays are basic structures wherein one or more elements exist "side by side" and are of the same "type". An "integer" array is an array whose elements are all of an integer type which has no fractional component. A "character" array is an array which contains nothing but character types. A "floating point" array contains elements that have both an integer and fractional portion. Simply put, they are arrays of particular types.


WHAT DOES Address Register DO?

Address Register are designed to make it easy to index into the array of constant register. The address allows you to provide a signed integer offset into the constant register.


What is integer array in C programming?

An integer array consists of only integer numbers, for instance, if you have the array of size 5 with integer type date int_array[5] it means that your first element int_array[0] is an integer number like 1, or 15 and so on. The same is true for other elements too; int_array[1](int_array[2], int_array[3], int_array[4]) might be any integer element and so on.


A magic square is a square array of positive integers such that the sum of each row column and?

I recently studied a magic square. It is a square that when each row, diagonal, horizontally, or vertically is added up, it equals the same positive integer.


How do you write a C Program to fill up an Integer Array?

Reference:cprogramming-bd.com/c_page1.aspx# array programming


What are the permissible data types for an array index?

Integer (signed or unsigned)