Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In C language, one-dimensional array is defined as: type descriptor array name-
In C language, one-dimensional array is defined as: type descriptor array name-
In C language, the definition of one-dimensional array is: the name of the type descriptor array-for example, intarray [10]; Meaning: An array is defined, called array, with 10 elements, all of which are integers. The names of 10 elements are: array[0], array[ 1], ..., array [9].

In C language, one-dimensional array is defined as follows:

Type descriptor array name [number of elements]

Among them, the type name determines the data types of all elements, and the number of elements gives the number of variables to be included in the array. It can be in the form of an expression, but only variable constants and operators can appear in the expression.

Common types: char, int, long. Floating, double precision.

The general representation of array elements is:

Array name [subscript]

The subscript can be an expression, but it must be an integer with a certain value, ranging from 0 to the number of elements-1.

Note: You should not use out-of-bounds subscripts when referencing array elements, because in this case, the system will not report an error when compiling, so you should pay special attention when writing programs.

What is the longest dimension of one-dimensional array in C language? Thank you. According to ANSI C89 standard, the size (subscript) of an array must be an integer constant expression in order to calculate the size at compile time, and the so-called constant (or the operation result of a constant expression) here generally refers to unsigned int.

In a 16-bit compiler (such as Turbo C), unsigned int is 16 bit, so the array has a maximum of 32,767 data.

In a 32-bit compiler (such as Visual C++ 6.0), unsigned int is 32 bits, so the array has at most 4294967295 data.

The above conclusions are theoretical values.

In fact, in VC++, we defined an integer array with 259,025 elements. Although it can be compiled, we will still get a runtime error. This is mainly related to the size of heap and stack. Please refer to the relevant information of the operating system for details.

Example of error code:

In VC++ 6.0.

void main()

{

int a[259025]; Runtime error, 259024 no problem.

char b[259025]; Ok.

char c[ 1036097]; Runtime error. 1036096 No problem.

}

In TC2.0,

void main()

{

int a[32768]; Compilation error, 32767 can.

char b[65536]; Compilation error, 65535 will do.

}

In C language, does one-dimensional array name represent an address constant? Arrays are generally used as variables, but as parameters of functions, they are weakened into pointers. At this point, you must add a parameter representing the length.

If you make a constant, you seem to have to add const.

for reference only

One-dimensional array x[ 10] is defined in C language, in which odd numbers are placed at the left end of the array and even numbers are placed at the right end of the array. # include & ltstdio.h & gt

# include & ltstdlib.h & gt

main() {

int x[ 10];

int i,j,t;

Printf ("Please enter 10 int data: \ n");

for(I = 0; I< 10; i++)scanf("%d ",& ampx[I]);

for(I = 0; I<9; i++)

for(j = I+ 1; j & lt 10; j++){

if(x[I]% 2 = = 0 & amp; & ampx[j]%2! = 0){ t = x[I]; x[I]= x[j]; x[j]= t; }

}

for(I = 0; I< 10; i++)printf("%d ",x[I]);

Returns 0;

}

How to express two-dimensional array with one-dimensional array in C language? After defining a[][4] as a four-column two-dimensional array, a[2] is *(a+2), where a is an array pointer pointing to four integers;

A[2] can also be understood as&; A[2][0], because array A actually only defines one row, so&; A[2][0] has crossed the line, but in C language, there is no error in cross-border access, so the address of a[2][0] is offset by 2 lines, that is, 8 integers and 32 bytes. This is understood as&; [0][0]+32 is also acceptable.

How to understand one-dimensional array and two-dimensional array in C language? More specifically, I is a cyclic variable, which has nothing to do with array A. A[i] refers to the value of the element with the subscript I in array A..

What happened to the one-dimensional array in C language? How to use a[i] as a one-dimensional array, a[i][n] as a two-dimensional array, and so on. . . Multidimensional array.

For example, a[4] is arranged as a[0] a[ 1] a[2] a[3] in the memory cell.

A[2][3] is arranged in memory cells like this. A[0][0]A[0][ 1]A[0][2]A[ 1][0]A[ 1]A

By analogy, regarding the usage, array is a group of variables with the same data type and arranged in a certain order, so the usage of array is basically similar to that of variables. . . I am a software major. I typed it word by word. I hope I can help you. . .