I want to use an array from a function submit
to createform.addEventListener("submit", function() {
return confirm("Continue?");
});
. So, I defined it globally. But array's parameters are present in function HashTableInit
. I don't want to take array by returning the function, because to use return I will need to call the whole function in printHash
, and it will disturb my whole code.
HashTableInit
Here, TableSize will be available after this function executes. But how could I define array globally with parameters.
答案 0 :(得分:0)
如果它不是指针,则可以使用全局值声明变量。 但在你的情况下,它是一个指针变量。您必须在分配值之前手动分配地址。因此,创建一个将值分配给指针变量的函数是一个好习惯。但是您可以分配数组和变量来全局存储数组大小。我希望它能帮助您。