All Questions
19 questions
0
votes
0
answers
55
views
What does actually character array in java store as an element a char or a unicode value?
char[] rotk = U.toCharArray();
for (int j = 0; j < rotk.length; j++) {
rotk[j]+=cipher;
if(rotk[j]>122)
{
rotk[j]...
0
votes
2
answers
73
views
Casting an int array into a char pointer in c
I ran through these few lines of code in C:
int tab[]={4,6,8,9,20};
char *p;
p=(char*)tab
And the question was how to print the value of 20 using the pointer p.
So i used a for loop to see what'...
0
votes
2
answers
68
views
How to store single chars in a twodimensional char array?
I simply want to create an array which holds "arrays which hold single chars".
So I wrote:
#include <stdio.h>
int main(){
char *field[20][20];
for(int i=0;i<20;i++){ //makes blank 2d ...
2
votes
1
answer
96
views
Short to Char Casting
I have seen this done both ways. Is there any advantages or disadvantages to doing it either way?
short x = 0x9D6C;
char cx[2];
First way:
cx[0] = x &0xff;
cx[1] = (x >> 8) & 0xff;
vs....
1
vote
0
answers
56
views
java Arrays.asList() returns something unexpected for char array [duplicate]
Recently i came across the situation, that i wantet to convert a char array to a List. However, in the end i needed to solve my problem another way, because what Arrays.asList() returned wasn't what i ...
3
votes
7
answers
1k
views
Trimming /null values from string after converting from char[] (in C#)
There is an array of characters e.g.
char [] biggerText = new char [8];
then I input some values likewise:
biggerText[0] = (char) 12;
biggerText[1] = (char) 48;
then I use the following operation:
...
2
votes
2
answers
110
views
Is C implicitly and weirdly casting this char in an array to an int?
I've got a function which is supposed to insert a short into a char array, big-endian. This is what it looks like:
unsigned short getShort(char* arr, int index)
{
unsigned short n = 0;
int i;
...
0
votes
2
answers
1k
views
Char array to unsigned short conversion issue
I am trying to convert char array to unsigned short but its not working as it should.
char szASCbuf[64] = "123456789123456789123456789";
int StoreToFlash(char szASCbuf[], int StartAddress)
{
int ...
0
votes
3
answers
63
views
Interpreting Char-Array to Multiple concatenated Datatypes
I receive via Socket a stream of bytes (or chars in C++). Now I want to interprete them. I know which datatypes are hidden behind the bytes. My message looks somehow like that:
value1 --> char (...
1
vote
3
answers
3k
views
Casting char array into int array using atoi
Hello I'm attempting to convert a char into an int. I have a char array that was inputted through scanf, "10101" and I want to set an int array's elements equal to that char arrays elements.
example ...
1
vote
1
answer
113
views
casting int[] to char[] does not work properly
// EDITED: Sorry, I did not paste an important code. I edited the post with the rest of code.
I have a problem with casting Array of Integers to Array of Characters. Everything compiles, but there ...
0
votes
4
answers
114
views
"must be an array type but is resolved to char" Tic Tac Toe Program Error
So, I'm creating a tic tac toe program according to the instructions provide to me. Looks like most of the code is complete except i'm getting an unusual error when compiled.
"array required, but ...
2
votes
2
answers
10k
views
Convert uint32 address into char array
I would like to convert a uint32 to a char string for printing purposes. My uint32 is an address that looks something like "0x00402B00"
I could care less about the preceding "0x", but it doesn't ...
1
vote
1
answer
113
views
Strange output of char array converted to int - magic of array[x] - '0'
So I'm fooling around with char arrays conversion and testing now this simple code:
#include <stdio.h>
int main(void) {
char arr[BUFSIZ];
printf("Input: ");
fgets(arr, sizeof(arr),...
1
vote
1
answer
3k
views
invalid conversion from cql::cql_byte_t* {aka unsigned char*} to const char*
I am trying to extract few bytes from a byte array in C++.. I am using ntohs to extract first two bytes which is my schemaId.. So I created a method in FileMapMgr class that will be doing the ...