16 questions
The size of the array is determined at compile time, so to declare an array of dynamic sizes int size;scanf(%d, &size);int* arr = (int*)malloc(sizeof(int) * size); I was taught to do this, but eve...
ArrayList<String> places = new ArrayList<String>(); places.add(Buenos Aires); places.add(Córdoba); places.add(La Plata);For example, there is a source like this, and I want to reduce the i...
Map<String,String> test = new HashMap<String, String>{test:test,test:test};Is there a way to initialize HashMap like the code above? Is the code above grammatically correct?
I want to initialize the same value from beginning to end when declaring an array.Now int myarr[30];for(i=0; i<30; i++) myarr[i] = 3;I'm doing a for statement like this, but not memset()myarr[all] ...
How can I declare and initialize the structure in a different place?For example, in this code,typedef struct MY_TYPE { boolean flag; short int value; double stuff;} } MY_TYPE;void function(void) { MY_...
int array[100] = {0};I heard that the entire silver element is set to zero, so I thought I just need to set oneint array[100] = {-1};So the first element is minus 1, and the rest is zero.I don't want ...
#include<iostream>using namespace std;class Test{ private: char* str; public: Test(char* name){ str=name; } void hello(void){ cout << str; }};int main(){ Test ptr(lee); ptr.hello(); ...
int a[] = {1,2,3,4,5};Like this.
How do I initialize private static member?There is an error in the way I did itld: 1 duplicate symbol for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocat...
Until now, I understood that static initialization block is used when it is impossible to set the value of the static field with one line.But I don't know why I need a special block for that work. For...
- 1 - | » |
© 2024 OneMinuteCode. All rights reserved.