Questions tagged [char]

char refers to the character data-type, representing letters, digits, punctuation marks, control characters, etc. Use this tag for questions relating to and usage of the character data-type.

Filter by
Sorted by
Tagged with
0 votes
0 answers
39 views

How do I correctly handle console operations with char type in C?

I'm doing a logic exercise (begginer stuff) in which the user is presented with the options to type "A" for an arithmetic average of his school grades and "W" for a weighted ...
Matheus Caetano Rocha's user avatar
0 votes
0 answers
29 views

My Convert_to_Hex function in C modifies previously converted variables [duplicate]

I have three char arrays each filled with 32 chars. I'm trying to convert each of them to HEX and store them in a 64 byte char array. The first char array, ai_values_temp get converted normally and ...
Murad Bashirli's user avatar
0 votes
1 answer
61 views

strcpy() showing incompatible integer to pointer conversion

char arr[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; char var; // Asking input from user for (int l = 0; l < 3; l++) { for (int k = 1; k < 3; k++) { ...
Rupam Karmakar's user avatar
0 votes
0 answers
13 views

Is there a standard for disambiguation in character sets?

Is there any form of standard for a character set where similar-looking characters are excluded? Examples of characters that can easily be misread by a human: il1! oO0 4AH 5S 7T I'm asking because I'...
Reyhn's user avatar
  • 1,007
-1 votes
1 answer
49 views

Anyone knows what I did wrong in this program?

I am trying to encrypt() and decrypt() strings in the parentheses using this program, but it keeps encrypting and decrypting the closing parentheses and the words after. if (strncmp(input, &...
O D E's user avatar
  • 21
-1 votes
2 answers
35 views

Function to read file passing it by parameter

Hi guys I'm having difficulty with a method to read file.I have not found anything in the documentation. I'm trying to return an array of char. public class ReadFile { public static void main(...
Maiinjoon's user avatar
-1 votes
2 answers
61 views

How to remove the first and last character out of a 5 character String

I am creating a program in which you recieve a 5 character String from the user and not only do you turn it around, but you also remove both the first and last character of said String. I've gotten it ...
Felipe Ramirez's user avatar
0 votes
0 answers
15 views

Element missing in the first column of the first row when reading CSV in java

I have a csv file: A,1 B,2 C,3 Whenever I try to get the character of the first column of the first row using .charAt(0), it return nothing. I tried to read the csv row by row and print the whole row ...
Jimmy 's user avatar
  • 13
1 vote
3 answers
81 views

How to check a char is EOF or \n

I would like to count how many sentences in the paragraph, and the sentence is defined as a sentence ends in . followed by two spaces, such as "a. " a sentence ends in . followed by a ...
ident's user avatar
  • 68
1 vote
1 answer
40 views

JAVA Regex identifying strings \"string"\ or characters \'char'\ inside a string

So, I am facing the following issue: The strings that I am getting are in the form of "string" or 'char'. In short they are coming with their own '' and "". When the String ...
Abdurrafay i190610's user avatar
0 votes
0 answers
33 views

size of array function parameter will return char* [duplicate]

I wanted to store a string with spaces and the print it. As I want to store spaces I´m using fgets(), right after I remove from the char array the '\n' that I type when introducing the text. And it ...
AaronMaiden99's user avatar
0 votes
1 answer
37 views

Is it possible to create an EF relationship using char fields?

I have 2 entities that look like this: public class User { [Key] public string UserID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } ...
Rich's user avatar
  • 13
0 votes
4 answers
86 views

Extract characters from char array in C

I am trying to extract two last characters from a char array and has been unable to do so. The array will be given to me and I don't have control over it. I only know the last n positions of the array ...
DuttaA's user avatar
  • 913
0 votes
1 answer
54 views

C Programming - Counting Frequencies Of Characters In A String (Problem In My Code)

I am trying to do this exercise in C programming: "Write a program that takes a string as input and counts the frequency of each character.". I have written this method: void ...
Thriller's user avatar
3 votes
3 answers
86 views

Why is the new string not being printed after adding char characters?

I'm stating to write some leetspeak code in C, however, I keep getting error like: error: incompatible integer to pointer conversion returning 'char' from a function with result type 'string' (aka '...
dbeltranor's user avatar
1 vote
2 answers
39 views

Copying every other element from one array to another in pointer notation

I'm making a function copy that will copy every other element from *source to *destination to a given numChars. So if source is Hello, and num chars is 2 destination will be "Hl". However ...
Dylan0127's user avatar
-3 votes
4 answers
68 views

Making a function that reverses the order of chars in a char array

I've been really struggling with understanding pointers. My function is supposed to reverse the order of chars, so if w is green it will reverse to neerg. The function I have looks right to me, but ...
dylangiantsfan's user avatar
0 votes
1 answer
46 views

Take the difference of two corresponding chars in a char array

I need to make a function that will take the difference of two corresponding chars, and then add them all up. So if s="3AB" and t="7C" I need to return ('3'-'7')+('A'-'C')+'B' Can'...
dylangiantsfan's user avatar
16 votes
2 answers
1k views

C++23: char now supports Unicode?

Does C++23 now provide support for Unicode characters in its basic char type, and to what degree? So on cppreference for character literals, a character literal: 'c-char' is defined as either: a ...
mishar's user avatar
  • 369
0 votes
4 answers
106 views

Deleting characters more than once in a word in a string

I'm a very new programmer and I'm having difficulties with a string problem in C. I want to output the 'words' with no letter duplication. It's okay to duplicate in other words. For example, if I type ...
Labrynth's user avatar
0 votes
0 answers
9 views

error:cannot convert 'const char*' to const string*

#include <iostream> using namespace std; int main() { int i = 5; double d = 0.5; const string *ps = "Hello Man"; char *pc = "k"; void *pv; pv = (...
Albert Wang's user avatar
0 votes
0 answers
4 views

function to count character from hashing result

what is wrong with this code: this the hole sintax: import bcrypt import hashlib import time import string Sample password password = "mySecretP@ss" def bcrypt_hash(password): salt = bcrypt....
indra respati's user avatar
1 vote
1 answer
57 views

Character constant ignore

I need to compare variable value with backslash symbol: char symbol; /* assigning a value to a variable */ if (symbol == '\') { // some action } But my Visual Studio recognizes it as a character ...
Егор Трифонов's user avatar
1 vote
3 answers
84 views

How to transform strings representing 'special' characters to their character representation

I want to turn two-character strings representing special non-printing characters, such as "\t","\n","\a",... into their single character representations. Is there any ...
136's user avatar
  • 1,095
-2 votes
1 answer
52 views

c# string convert char

I am new to C#, both of the values below are valid, what is the difference between them ? // 1st option: string value; // ... char tt = Convert.ToChar(value); // 2nd option: string value; // ... char ...
Tanju Demir's user avatar
0 votes
0 answers
28 views

How to work with each individual word in a char** datatype

I have a function that returns all words entered per line as an array of words as follows: char **commands(const char *command){ char **commands_list; int count,pos,len,i; for(pos=0,count=...
Wragnam's user avatar
  • 19
0 votes
3 answers
73 views

C switch, how to fix multiple default prints?

If i give my program this: abcdefghijklmnopqrstuvwxyz It answered with this?! Invalid command a Invalid command c Invalid command e Invalid command g Invalid command i Invalid command k Invalid ...
Ronja Oksanen's user avatar
0 votes
1 answer
45 views

I'm trying to print a phrase in a line but there is an extra line-break in my do-while loop and I wonder why?

Good evening, I created a word search program and my output should be in the form "A palavra % está no texto!" or "A palavra % não está no texto!", however it looks like this: A ...
Larissa's user avatar
0 votes
1 answer
67 views

I'm trying to create a character array where each line is a different word, however the "\n" in my do-while loop isn't working. I wonder why?

I have a college assignment in which I must create two matrices. The first works correctly, but this one is not recording each word on a different line. I already put NULL, "\0" and "\n&...
Larissa's user avatar
-1 votes
3 answers
59 views

Converting a String to Binary and Displaying the result

I am trying to parse individual characters in a string, convert them to binary, and then show them on a screen so that I can see the result. I have found many solutions for converting a string to ...
user3763812's user avatar
0 votes
1 answer
42 views

the reason why type char can be converted in specifier %d?

I suddenly noticed that i've used conversion specifier %d with type char although %d takes only type int. How is it possible? According to c standard, conversion specifier %d is corresponding to type ...
kanoo12's user avatar
0 votes
2 answers
64 views

MPI_Bcast returns EXIT CODE: 139 on large char arrays

I would appreciate, if you could help me troubleshoot the following situation. I broadcast (on localhost) a char array in 2 consecutive steps: MPI_Bcast the size of the array MPI_Bcast the array ...
user1221647's user avatar
1 vote
2 answers
192 views

c++: unexpected result of const char* in struct array assignment

c++: unexpected result of const char* in struct array assignment my code: #include <pthread.h> #include <iostream> #include <vector> using namespace std; typedef struct { int ...
qings Azure's user avatar
0 votes
0 answers
96 views

C++ special chars

I'm just starting to learn C++ and I wanted to know how to display special characters like in this french sentence "J'aime le café" and I don't want to have to put something like \uefdddf. I ...
BatteTarte's user avatar
0 votes
1 answer
21 views

How to delete a symbol from file by its position

I need to delete a symbol from txt file by its position in file. For example, there is a text file sample.txt: Hello, world! Abcdef hello world and I need to delete a character , that is located on ...
TimKostenok's user avatar
-1 votes
2 answers
46 views

can i fill a used hashmap with zeros after its been used? C programming

im asked to build a function that finds the longest substring with no repeating characters in a given string. this is gonna be a 2 in 1 question bc i want to now if my approach is correct and if "...
user1188938's user avatar
-1 votes
1 answer
48 views

C addressing method

#include <stdio.h> #include <stdlib.h> #define can 100 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ void hesaplacumle(int ...
Khansokhua's user avatar
0 votes
3 answers
85 views

How to convert an integer to char array in C? [duplicate]

How do I properly convert integer into char array in C without using functions like sprintf? For exmample, Input int data0 = 1010 char data1 []; Output data1[0] = '1' data1[1] = '0' data1[2] = '1'...
K.Son's user avatar
  • 29
1 vote
2 answers
59 views

Is it possible to enter a signed char into a scanf function

I'm wondering if it is possible to save a signed char into a scanf function /* Program to scan in a negative char */ #include <stdio.h> int main (){ signed char myChar;/* trying to save a ...
ben's user avatar
  • 135
0 votes
0 answers
20 views

bytes array into a char in VBA

Char 𑁡 (as an example) in UTF 8 consists of four bytes: 240, 145, 129 and 161. Could anybody explain me how can I convert bytes array below into a char in VBA? A working code example would be very ...
newman's user avatar
  • 149
1 vote
2 answers
83 views

why does the variable become 0 suddenly?(c language)

i was practicing basic so i write a code to ask about user name and then i wanted to print user name character by character , then the whole name and the length of it and at the end the even numbers ...
Amirhosein hajiebrahimi's user avatar
0 votes
0 answers
24 views

Unable to find size of unsigned char string returned by solvable_lookup_bin_checksum() of libsolv librray

I am trying to collect the binary checksum of a package using solvable_lookup_bin_checksum() of libsolv library. But I am not sure how to find the returned unsigned character string length as it ...
shivani's user avatar
  • 11
0 votes
3 answers
141 views

How to use original index of a string to erase single character?

Assume that I have a string 'abcd', and a vector [4,1,3,2] to index the string. For example, first element of vector is 4, so I should remove 4th character in 'abcd' which refers to 'd'. Then the ...
Sonny's user avatar
  • 11
-1 votes
1 answer
76 views

How to display a C++ char variable's memory address? [duplicate]

While practicing with C++, I tried to display a char variable's address with the & operator, but I see a meaningless line of characters instead of a memory address. Below is the complete program: #...
ekanlar's user avatar
0 votes
4 answers
107 views

C Dynamic Array Size

Hello I am new to coding and was just wondering why the below code: #include <stdio.h> int main() { for(int i = 0; 1 ; i++) { char x; char z[1+i]; x=getchar(); if (x == '\n'){ ...
soda2718's user avatar
1 vote
1 answer
101 views

Modify a const char parameter

I am currently programming a function which should save a number of characters to a const char*, which is a parameter to the function. The overall functionality is given and I cannot change the ...
glemau's user avatar
  • 33
5 votes
1 answer
86 views

cout is causing memory leak on printing address of pointer to char?

I have very basic program to print address of pointer to char but when I run this code it causes memory leak. I am using termux on android device. The command I am using to run the file is g++ -Wall -...
Bishnu Chalise's user avatar
1 vote
1 answer
29 views

How to coustomise the Y-axis grid line css properties in c3js

I have created a line chart with time series data. I used custom X-axis grid lines and increased their spacing by editing their CSS. I would like to increase the spacing between the grid lines on the ...
Akhil S Babu's user avatar
-1 votes
4 answers
76 views

I'm confusing about the output of this content

I don't understand why the syntax is char d = 'a' + 3; but when printed it out System.out.prinln(d) is d not a + 3. I tried the output and it was unexpected and I don't understand why it print out 'd' ...
Julia Tran's user avatar
1 vote
0 answers
94 views

How to create pyspark dataframe with CharType column?

I'm trying to create a dataframe with "rich" column data types in pyspark (Spark version 3.4.0): from datetime import date from decimal import Decimal from pyspark.sql import SparkSession ...
Kai Roesner's user avatar

1
2 3 4 5
266