Results 1 to 8 of 8
Hybrid View
-
16th January 2011 14:10 #1Registered User
Join Date: Jan:2011
Location: bg
Posts: 4
1. ++, :
a. 3 4 ;
b. ;
c. 1 3 ;
d. 2 4 .
2. , , .. .
3. , 12 .
4. , , .
2- , 2- " " - ? , ?
!
-
16th January 2011 14:27 #2
C/C++ , , :
a[0][0], a[0][1], ..., a[0][N-1], a[1][0], a[1][1], ..., a[1][N-1], ..., a[M-1][0], a[M-1][1], ..., a[M-1][N-1]
( , a[M][N])
a[i][j] i*N+j . : a[i][j] *(a + i*N+j). :Code:a[i][j] = a[i-1][j] + 5
:Code:*(a + i*N+j) = *(a + (i-1)*N+j) + 5
a[i] *(a+i)
(. a[M][N][P]):
a[i][j][k] *(a + i*N*P + j*P + k)Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
16th January 2011 14:28 #3
http://www.cplusplus.com/doc/tutorial/pointers/ -> Pointers and arraysHave no fear ike iz here.
CPU Cx486DLC@40MHz, RAM 4MB, VGA Trident 512KB, HDD Conner 160MB, Monitor 14" Color
-
16th January 2011 15:58 #4Registered User
Join Date: Jan:2011
Location: bg
Posts: 4
, :
Code:int arr[3][4]={0}; for(int i=0;i<3;i++){ for(int g=0;g<4;g++){ *(arr+i*4+g)=(rand()%10); } }:/Incompatible types in assignment of 'int' to 'int [4]'
:Code:int arr[3][4]={0}; for(int i=0;i<3;i++){ for(int g=0;g<4;g++){ cout << **(arr+i*4+g)<<endl; } }
?0
0
0
1879090456
1606416496
1606416496
0
1879090456
1879090456
1606416504
1606416512
0
---------- 15:58 ---------- 14:38 ----------
..
Last edited by kokodilche; 16th January 2011 at 15:07.
-
16th January 2011 16:36 #5
:
- int *pa = (int*)a pa a ;
- a: *((int*)a + i*4 + g) = ...;
- a : int a[3][4] int a[3*4].Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
16th January 2011 16:50 #6Registered User
Join Date: Jan:2011
Location: bg
Posts: 4
,
Code:cout << (arr+((1*3)+1));
Code:cout << *(arr+((1*3)+1));
Code:cout << **(arr+((1*3)+1));
10 4 +1

---------- 16:50 ---------- 16:38 ----------
,... . :/ , ..*((int*)arr+i*4+g)
-
16th January 2011 17:15 #7
, - , -. , , :
- &a[0][0] int* ;
- a[0] int* ;
- *a int* ;
- a int* .
:
64- :Code:int arr[3][4]; cout << arr[0] << " " << arr[0] + 1 << endl; cout << &arr[0][0] << " " << &arr[0][0] + 1 << endl; cout << *arr << " " << *arr + 1 << endl; cout << (int*)arr << " " << (int*)arr + 1 << endl;
Code:$ ./a.out 0x7fff5fbffad0 0x7fff5fbffad4 0x7fff5fbffad0 0x7fff5fbffad4 0x7fff5fbffad0 0x7fff5fbffad4 0x7fff5fbffad0 0x7fff5fbffad4
Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
16th January 2011 21:09 #8Registered User
Join Date: Jan:2011
Location: bg
Posts: 4
, .
, , .
2- , 3-
---------- 21:09 ---------- 18:29 ----------
,




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in