Most voted "char" questions
Char usually refers to a type of character data, representing letters, numeric digits, common punctuation signs etc. Use this tag for questions directly related to char data, specific methods and comparisons. For questions about String, use the specific tag [string].
Learn more…124 questions
Sort by count of
-
0
votes2
answers243
viewsConvert VB code to C# which turns characters into numbers
I have this code in VB and need to convert to C#. Public Function eNumero(s As String) As Boolean If s = "" Then eNumero = False Else eNumero = Asc(s) >= Asc("0") And Asc(s) <= Asc("9") End If…
-
0
votes1
answer156
viewsRead char matrix from a binary file
Function that writes and reads binary file: int FUNCAO_QUE_GRAVA_BIN (char filename[],int partida1,char resultado1) { typedef struct { int partida; char jogvelha[3][3]; char resultado; } velha;…
-
0
votes0
answers105
viewsDifficulty making Foreign key with two char fields in Mysql
I am unable to create a Foreign key between two tables, whose type is CHAR: ALTER TABLE hardware ADD CONSTRAINT fk_INC_LOCALIDADE FOREIGN KEY ( INC_LOCALIDADE ) REFERENCES localidade (INC); The…
-
0
votes1
answer1629
viewsGenerate random characters with the Random class
I was given the following code to help in the resolution of an exercise. Random gerador = new Random(); gerador.setSeed(4); System.out.println((char)(’a’ + (Math.abs(gerador.nextInt()) % 26))); I…
-
0
votes1
answer388
viewsMultiply even index values of a string in C
The question I need to solve is the following: The person gives a number, I need to multiply by 2 all the numbers that are in the "index" even, the problem is that the index starts at 1 on the…
-
0
votes1
answer50
viewsSegmentation failure - C
#include <stdio.h> #include <stdlib.h> #include <string.h> int validaTipo(char t); typedef union{ struct contratoIndividual{ unsigned int…
-
0
votes2
answers40
viewsHow to pass the value of a variable char to another char in C
My doubt is how I successfully pass the text from one char variable to another also char? I’m trying the following: salva_nomeMaior[30] = dados[i].nome; The variable that is with the text that is…
-
0
votes0
answers33
viewsDoubt in stdin flow of scanf() function
Greetings to all. I am a beginner in C and I came across the following question regarding data entry; int number1,number2; printf("Digite o numero : "); scanf("%d",&number1); printf("Digite…
-
0
votes4
answers48
viewsChar variable is not receiving values in C
Good afternoon, everyone my variable char z is not working with either scanf_s or gets_s. With the scanf it generates an exception and locks the program, using gets_s at the time of entering the…
-
0
votes1
answer293
viewsSave data from a txt file to an entire struct or manipulate struct. C
I have a txt file that follows the template below. I want to save the balance as int, but with fgets I can’t get it. I’m wanting to save as int, because after the data is taken the program sorts…
-
0
votes1
answer43
viewsError type char C++
Hi, I’m getting this error when I try to save a character from a txt. error: request for Member ĩc_str' in’d[j]', which is of non-class type ĩchar'113 | fscanf(iFile, "%c", d[j]. c_str()); Below is…
-
0
votes1
answer58
viewsDo-while with char in C
EX. Create a program that reads sales values (old and new) of a product. The program must calculate the percentage increase of the product. The program ends only when the user informs the letter "N"…
-
0
votes1
answer59
viewsHow to do an operation using the CHAR variable TYPE?
Follow two codes. The first makes the desired operation with if and else. The second (which I am doubtful about) I try to recognize the char typed as an operator to perform the operation. #include…
-
0
votes1
answer65
viewsHow to pass a char vector * (*) to a function?
Guys, I have this code: #include <stdio.h> void exibir_nomes (char *nome) { for (int i=0; i<5; i++) printf("Nome[%d] = %s\n", i, *nome); } int main () { char…
-
-1
votes2
answers171
viewsAdd a char on a char pointer in C/C++
I need to add a char on a pointer of char. For example: I have a pointer of char called name, which receives "log", after the process, I want it to be "log1". I tried to implement it like this, but…
-
-1
votes1
answer1260
viewsRead char and string in c++
I have to put an integer, a real, a character and a sentence containing spaces up to 100 characters. I tried to make the solution but, I can only type the numbers and it is not leaving the character…
-
-1
votes1
answer18
viewsI cannot print the array names received by the scanf, I need to print the 3 after the repetitions of the end
int main(void) { int i, idade; float peso, media_peso, media_idad; **char nome[3][11];** for(i=0 ; i < 3 ; i++) { printf("digite seu nome…
-
-1
votes1
answer26
viewsChar in c problem
Good evening guys I’m here with a problem that automatically my value is read on IS() anyone know why this is happening? can’t find the error. if((con1 != 0) && (con2 != 0) && (con3…
-
-1
votes0
answers15
viewsMount a string with user-delimited size and can be parsed character by character
I need to keep several names (compounds) of different people, so that I can return to the user the first letters of each name, and the last name of each person. That’s what I’ve done so far:…
-
-2
votes1
answer611
viewsHow to check if a field of an array of chars is empty in Java?
I am trying to check whether a particular position of an array of chars actually contains some character. I tried it two ways: char[] arr = new char[10]; if(arr[0] == null){ } And also: char[] arr =…
-
-2
votes1
answer65
viewsWhy doesn’t my summation work?
I have this activity: Write a function that receives, as input, a vector of n > 0 elements of type Cell and return, as output, the sum, of the weights of all vector elements belonging to bands.…
-
-3
votes1
answer39
viewsLimit a specific value to a string
need to limit and a specific value that would be 511 char command[512]; I tried with char command[512]; scanf("%511s",command); if (StrToInt(command))>511) printf("FIX ATK"); and that too char…
-
-4
votes1
answer339
viewsHow do I compare a character in the range of an alphabet?
The question is this:: 1)Help the university set up the divisions of the programming laboratory. For this, write an algorithm that reads the student’s name and tells which division he is respecting…
-
-4
votes2
answers451
viewsHow to give 'value' to a char variable?
I have a question about how I can give value to the char variable without the scanf command, for example: I have a variable called name and I want to say that it is worth maria. how do I do that?…