How can I safely read each line of a file into an array in Bash 3.2?
I need to read a text file line by line and store the results in an array. My current function works in newer Bash versions by using a…
I need to read a text file line by line and store the results in an array. My current function works in newer Bash versions by using a…
I'm a beginner learning C in college, and I've recently become comfortable with loops. We're now working with arrays, including two-dimensional arrays, and I'm confused about how many…
I'm building a chess game in Visual Studio and need to move pieces around a two-dimensional array. I can loop through the array and locate a piece, but…
I'm trying to understand this C function that sums the first n elements of an array: int sum(int *t, int n) { int sum = 0; for (int…
In C, this function sums the first n elements of an array: int sum(int *t, int n) { int sum = 0; for (int i = 0; i…
I'm new to PowerShell and ran into confusing behavior when building an array of file paths. A single concatenation works as expected: $test = $ENV:USERPROFILE + 'NTUSER.DAT' This…
I imported a CSV file with `$data = Import-Csv -Path "path\to\file.csv"` and loop through the resulting collection. I can read individual values with expressions such as `$data.OffLastName[$jj]`, `$data.ReportsToLast[$jj]`,…
I'm building a small helper where several keys should point to the same value. For example, 1, 2, and 3 should all retrieve the function associated with the…
I understand that foreach loops through a collection, but I'm trying to understand what happens in an expression like `foreach ($computer in $computers)`. I created `$computers`, for example…
I've been trying to learn data structures and algorithms (DSA) for a while now, but I keep finding myself stuck at the basics like arrays and strings. I…
I'm looking for some guidance on working with methods in Java that take arrays as parameters. Can anyone share tips or insights on how this works?
I've been teaching myself programming since July 2025, and I've managed to get a grasp on HTML and CSS without a hitch. However, when I switched to JavaScript,…
I've been learning Java and started off strong, but I hit a wall with concepts like loops, arrays, and methods. I feel like whenever I encounter a slightly…
I'm trying to create a script that mimics multi-dimensional arrays for a personal project. I generate surnames, traits, and more, but I feel like I'm going about it…
I'm trying to figure out how to write a program that will find the largest number in a given array. I understand that the solution involves looping through…
I'm a first-year university student currently learning programming in C, and I've hit a snag with a couple of tasks that seem quite daunting. Here's a breakdown of…
I'm working on a bash script where I have a series of text files, each containing an array of the same length. I want the script to loop…
Hey everyone! I'm fairly new to coding and currently diving into Java, specifically working on loops right now. I've found some parts tricky, especially with understanding how loops…
Hey folks! I'm really struggling with arrays in data structures and algorithms (DSA). There are so many techniques like two pointers, sliding window, binary search, hashing, and others…
I'm working on a script where I'm iterating through a list of servers to get specific metrics and trying to store those values in an array. While the…