Results 1 to 6 of 6
Thread: C++
Hybrid View
-
10th April 2011 15:50 #1
C++
:
Code:: void arrayfill(int a[], int size) { for(int i=0; i<size; i++) { cout<<"input element "<<i<<" "; cin>>a[i]; } } : int v[10]; int len=10; arrayfill(v,len);
?
int* arr, . .Code:: int* newarray(int arr[], int oldSize, int newSize) { int* newArr= new int[newSize]; //ako stariq razmer e po maluk ot noviq, trqbva da kopirame elementite ot stariq masiv v noviq if(oldSize<=newSize) { for(int i=0; i<oldSize; i++) { newArr[i]=arr[i]; } } //ina4e noviq masiv e po maluk i 6te kopirame vuzmojno nai mnogo elementi else { for(int i=0; i<newSize; i++) { newArr[i]=arr[i]; } } //triem stariq array delete[] arr; arr=0; return newArr; //vru6tam ukazatel za noviq array } int a[0]; int size=0; a=newarray(a, size, ns);Config: Ryzen 3700x / Gigabyte x570 Gaming X / RX480 Strix 1400@2250 / 2x8gb Corsair Vengeance / Seagate Barracuda 1Tb + 256gb OCZ Trion / SuperFlower Leadex II Gold 750w / BeQuiet B801 / LG 23MA53 + Philips 170c / Logitech G502 / CM QuickFire TK
Acer Predator G9-593 I7 7700HQ + GTX1070
-
10th April 2011 16:23 #2Registered User
Join Date: Dec:2007
Location: Sofia
Posts: 366
, 'a'. ++ , modifiable lvalue, .. .
.
-
10th April 2011 22:14 #3
, ?
Config: Ryzen 3700x / Gigabyte x570 Gaming X / RX480 Strix 1400@2250 / 2x8gb Corsair Vengeance / Seagate Barracuda 1Tb + 256gb OCZ Trion / SuperFlower Leadex II Gold 750w / BeQuiet B801 / LG 23MA53 + Philips 170c / Logitech G502 / CM QuickFire TK
Acer Predator G9-593 I7 7700HQ + GTX1070
-
10th April 2011 22:20 #4
- C++ int a[10], C++ , " ". ,
,Code:a++
,
, ( , a 10 ).Code:a[12] = 5
, " " - "", .. 'a' , "" .
, '' " ", ., . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
10th April 2011 22:31 #5
:
. :int a[0];
, :delete[] arr; // arr e a, .
.int *a = new int[0];
0 , .EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|
-
14th April 2011 19:04 #6
! ^^ !
, , ?
:
Code:int* newarray(int* arr, int oldSize, int newSize) { int* newArr= new int[newSize]; //ako stariq razmer e po maluk ot noviq, trqbva da kopirame elementite ot stariq masiv v noviq if(oldSize<=newSize) { for(int i=0; i<oldSize; i++) { newArr[i]=arr[i]; } } //ina4e noviq masiv e po maluk i 6te kopirame vuzmojno nai mnogo elementi else { for(int i=0; i<newSize; i++) { newArr[i]=arr[i]; } } //triem stariq array delete[] arr; arr=0; return newArr; //vru6tam ukazatel za noviq array }Config: Ryzen 3700x / Gigabyte x570 Gaming X / RX480 Strix 1400@2250 / 2x8gb Corsair Vengeance / Seagate Barracuda 1Tb + 256gb OCZ Trion / SuperFlower Leadex II Gold 750w / BeQuiet B801 / LG 23MA53 + Philips 170c / Logitech G502 / CM QuickFire TK
Acer Predator G9-593 I7 7700HQ + GTX1070




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