I am currently doing a college project and most of my background comes from JS & Python. I have an Arduino that is receiving data and using ArduinoJSON to take in settings and deserialize them. I have it set up that the setting is a const char* setting. Which can contain a range of data ..
Category : char
I am developing program with ESP32 WIFI microcontroller where I need to scan the available nearby WiFi networks and store them in a list so I can use them later outside the function. I have initially managed to do everything easily using String type variable, but I hear a lot of bad words about using ..
I wonder why std::string::c_str() returns const char * type even though sting is char array type. string s("Hello"); There is a string s. It consists of a char-type array and s[1] = ‘a’; I can also change the elements as above. However, if I call c_str() to know the starting address of the string within ..
Here, I’ve made a function, that takes a character array and a single element array as input. The input of expression is like "56+78", and then someone suggested this approach of using ascii code and for loops to store the two "numeric" substrings as two numbers, and used the character and switch statement below. But, ..
There is such a task: The user enters five words. It is necessary to make one char array of c ++ from all five words. In the process of solving the problem, I wrote the following code: #include <iostream> using namespace std; int main() { const int size = 20; char res[100]; char sentense1[size]; char ..
when any array(of int or char type) is made like this char a[]="hello"; int b[20]; then is there two pointer variables made a and b which points to start of array?? and if yes then why this gives an error if i do as following char a[]; a="hello"; but in case of following no error ..
I am writing this program for class and I cannot seem to figure out how to make my Char array print values bigger than 1-9 as otherwise players will have to do math to be able to calculate which slot they want. Which I feel ruins the fun of the game. However, I am newer ..
I’m always wondering about the complaint of the compiler when I declare and define a char*-variable. char* myChar = "Char"; The compiler will complain that it cannot convert const char* to char*. It need an explicit conversion like char* myChar = (char*)"Char"; My first question is if this is the correct way to initialize a ..
I’m having problems with comparing two strings in case-insesitive way. I’ve tried lots of methods(functions) like strcasecmp, stricmp, strcmpi, etc. I had imported the libraries where those functions belong but still it can’t seem to detect them. Here is my code: #include <bits/stdc++.h> #include <string.h> #include <cstring> #include <mem.h> using namespace std; int main() { ..
I’m attempting to make a simple program that asks the user to input their first name, their last name, and their program they are studying. When running this CODE and entering programming 1 as my course_name value, the program will run as intended. However, the additional 1 that is stored in the array will not ..
Recent Comments