[Solved] I can not input the names into the char array using scanf

By char *stdnames[100]; you got an array of (pointers to char). The NEXT BIG QUESTION is Who will allocate memory for each of these pointers? A small answer would be – You have to do it yourself like below : stdnames[count]=malloc(100*sizeof(char)); // You may replace 100 with desired size or stdnames[count]=malloc(100); // sizeof(char) is almost … Read more

[Solved] Does this function I made correctly append a string to another string?

First, char *stuff_to_append_to[] is an array of pointers of undetermined length, that is not a valid parameter, as the last dimension of an array must be specified when passed to a function, otherwise, pass a pointer to type. Next, char **stuff_to_append is a pointer to pointer to char and is completely valid, but given your … Read more

[Solved] C++ Convert part of the Array into int

Hard to be sure because your question isn’t very clear. But perhaps this is what you want uint16_t z = *reinterpret_cast<uint16_t*>(array); Another possiblity is uint16_t z = static_cast<uint8_t>(buf[0])*256 + static_cast<uint8_t>(buf[1]); and another is uint16_t z = static_cast<uint8_t>(buf[1])*256 + static_cast<uint8_t>(buf[0]); Try them all, they differ only in what endianness they use. You should look that up. … Read more

[Solved] How to inverse string without library functions – C++

Did you maybe mean to do this: for (int i = 0; i < userString.length(); ++i) { if (isupper(userString[i])) { userString[i] = (tolower(userString[i])); } else if(islower(userString[i])) { userString[i] = (toupper(userString[i])); } } This will actually inverse. What you were doing before doesn’t work, and also only converts to uppercase 11 solved How to inverse string … Read more

[Solved] Getting the program to count the total amount of a char input from a user through a text file

Here is the code that u can formulate to find a letter count from a text file.i have pushed an harcoded letter ‘a’ u can change it to dynamic also. import java.io.*; import java.util.Scanner; public class CountTheNumberOfAs { public static void main(String[] args)throws IOException { String fileName = “JavaIntro.txt”; String line = “”; Scanner scanner … Read more