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.

The keyword char is used in many programming languages, often defining a 1-byte memory location representing ASCII, UTF-8, UTF-16, UTF-32, and ISO-8895-1 character encodings. Arrays of characters can create Strings used to form words, descriptive text, or even extremely large numbers unable to be represented exactly by 32 or 64 bits.

13281 questions
3
votes
3 answers

Swap 2 char of a C++ array

I have a problem with memory access. When i = 0, Visual Studio throws an exception with reference to a line as labelled in the following code. Can't access at 0x00AD8B3B and 0x00AD8B3B equals scr+np-i How can I fix the for-loop body so as to fix…
TAZO
  • 33
  • 1
  • 5
3
votes
2 answers

How do you express (Keys.Control | Keys.M) in F#?

In C#, you can express characters for the KeyPress event in the form Keys.Control | Keys.M. In F#, Keys.Control ||| Keys.M doesn't work. What does? Edit: Interesting indeed. Using System.Windows.Forms.Keys.Control ||| System.Windows.Forms.Keys.M as…
Muhammad Alkarouri
  • 23,884
  • 19
  • 66
  • 101
3
votes
2 answers

CHAR vs VARCHAR for password security

Are there any benefits of CHAR over VARCHAR for storing passwords? I have hunted high and low but can't find anything on this. I ask because I have been told to use CHAR for passwords and am intrigued as to why.
agent_smith1984
  • 233
  • 3
  • 13
3
votes
1 answer

Ouptut PIN from a MAC address using char

I am absolutly not doing C, but for a small thing, I need to make a very simple function. I have problem understanding the result. I have a MAC address and I need to output the PIN code. (wiimote) I got this function so far int main(int argc, char…
orugari
  • 414
  • 3
  • 17
3
votes
3 answers

Python char array declaration

Is there a way to declare a char array of a fixed size in python as in C for example char myArray[100] I also want to initializa all the characters with NULL.
wahab
  • 797
  • 2
  • 6
  • 24
3
votes
3 answers

Check sentence against the given regex and replace "<" with "less than" word

Pls read the comments in the code. Different scenarios ...it would be great if any one could tell me other solutions to achieve the same. Pls read the comments in the code. Different scenarios ...it would be great if any one could tell me other…
Vivek_Neel
  • 1,343
  • 1
  • 14
  • 25
3
votes
6 answers

copy or assign one string to another string in a 2 dimensional array of pointers

First of all, this is a test program, i wanna test something specific that i wanted to see if it works. Lets say that i wanna assign x to arr[0][4] and wanna keep this change so that arr[0][4] is x in the main function too: #include…
Cache
  • 471
  • 2
  • 5
  • 14
3
votes
2 answers

Why are the default values of char, double and float printed like that?

I have been trying to find out the Why am I getting a ' ' when I print a char variable which was initialized with the default value of '\u0000'? Also I know that float and double has a default value of "0.0f" and "0.0d", but here when I print their…
user5012346
3
votes
4 answers

Bizzare System.out.println() in Java Program

String messageFile = ... // Assume messageFile SHOULD have the string "MESSAGE" System.out.println("The messageFile is: " + messageFile + "!!"); Normally, one would expect the above command to output: The messageFile is: MESSAGE!!!! However, I am…
user402642
3
votes
2 answers

Buffer overflow vulnerabilities with char[ ] and char *

When I perform a strcpy to a char[]: char buf[100]; strcpy(buf[], largeInput); If largeInput is longer than 100 bytes we have a buffer overflow. However I have a question, if buf, instead of being a char[] is a char pointer, would there be a…
BVCGAAV
  • 301
  • 1
  • 4
  • 11
3
votes
3 answers

How to convert a int to a numeric char in C#?

I wan't to convert a int to a char, but I don't want the (char)int method, because (char)3 won't give '3' but ''. So, there's a built-in way to get what I want, or I need to make it myself?
3
votes
2 answers

c++ assign char values (by using stack pop) to char*

I am trying to reverse a char* by using a stack. stack scrabble; char* str = "apple"; while(*str) { scrabble.push(*str); str++; count++; } while(!scrabble.empty()) { // *str = scrabble.top(); // str++; …
coffeefirst
  • 125
  • 2
  • 11
3
votes
6 answers

How to replace a char in a string without using Replace() in Java?

I've been having trouble with this assignment: Given a string, replace the first occurrence of 'a' with "x", the second occurrence of 'a' with "xx" and the third occurrence of 'a' with "xxx". After the third occurrence, begin the replacement…
user5129558
3
votes
4 answers

C++ Best way to create a new string from index of char array?

I got a chars array like char ch[] = "This is a char array"; and I want to make a new string from index n to index j, for i.e. string str = stringFromChar(ch, 0, 5); //str = 'This'
user1018517
3
votes
1 answer

How to know the size (in bytes) of a char array passed to a function?

I am testing the sizeof operator. In two cases in my code, I get the size of the pointer (I think). In the other cases I get how many bytes the arrays occupy. How can I get the size of the array in bytes when I pass it to a function? Isn't the…
n233g16
  • 55
  • 1
  • 5
1 2 3
99
100