Questions tagged [chararray]
51 questions
0
votes
2 answers
fuggy concept on how function and character array work in function parameter
** I understood how the function getline is working, it simply assigning value in each s[] array address which gets stored into the char line[] array because function argument has local scope there is no conflict due to the use of different array…

kshitiz ghimire
- 61
- 1
- 8
0
votes
1 answer
Char array gets cleared after function gets() on C++
I'm trying to learn C++. Sometimes I get confused by C style strings and its functions. I've been using
char var[1];
fflush(stdin);
gets(var);
to write a string into a char array. I don't know if thats the most efficient way but thats how I've been…

GZanotto
- 31
- 3
0
votes
1 answer
How to make a 'zoom' function display squares outside of bounds in a 2D character array
Basically, I have to implement a variety of methods to mess around with a two-dimensional character array for a class (display, recolour, and zoom). I've got everything to work except for one problem- the 'zoom' function is meant to display the…

Blither
- 9
- 2
0
votes
0 answers
Making a 2D character array table in C
#include
int main (void){
char board[3][3];
printf("Enter X or O>");
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
scanf("%c", &board[i][j]);
}
}
printf("Board: ");
for(int i=0; i<3; i++){
for(int j=0;…

hade34
- 47
- 3
0
votes
1 answer
Arduino Char Arrays Weird Symbols
So in my arduino programm I am working with char arrays in a function. I try to save them globally, but no matter how I do it, the global arrays contain only part of the original array and a ton of gibberish symbols.
char* naam;
char*…

STEENBRINK
- 53
- 7
0
votes
0 answers
I want to make a directory with a variable Path
I want to make a directory with a variable Path but it only works, if I put the name of the directory in quotation marks. But then the name of the directory isn't variable anymore. I can't find any solution for that. I want that the variable inside…
0
votes
1 answer
How to remove an element from a char array in VB.NET?
is there any way to remove the element in char array I converted from a String?
Dim myString As String = "Hello"
Dim charArray As Char() = myString.ToCharArray
Your help would be much appreciated.. Thanks

Ryx
- 7
- 4
0
votes
1 answer
Can we map char[] to VARCHAR in Hibernate entity?
We don't want to store password in String variable in Hibernate entity class instead we want to store it in a char[] array so that we can empty the array after using it. Hence we are reducing the chance of Heap inspection.
Need your suggestion…

Panneerselvam
- 421
- 6
- 13
0
votes
1 answer
Unexpected \u0000 insted of '0' when concatenate char arrays
I've got unexpected \u0000 at leetcode:
Same code works fine locally in linqpad:
public string AddBinary(string a, string b)
{
var result = a.Length > b.Length
? new char[a.Length]
: new char[b.Length];
result.Dump();
…

A K
- 714
- 17
- 39
-1
votes
2 answers
Why can't i use loops to take input of a char array?
#include
#include
using namespace std;
int main()
{
int size; char str[size]; cin>>size;
for(int i=0; i>str[i];
}
return 0;
}
example: size=10;
I was expecting this program to take 10…

Prakhar Arora
- 17
- 3
-1
votes
1 answer
How does a null character behave in a char array in C?
I tried to reverse this char array with null characters in the middle and the end, without using string length. (original code)
#include
#include
int main()
{
char string[4] ={'c', '\0', 's', '\0'};
…

Petrichor
- 1
- 2
-1
votes
2 answers
C++ return char* then delete it
So I have this function:
char * func()
{
char * temp = new char[length]; // Length is defined elsewhere
/*
Do some stuff with temp
*/
return temp
}
My problem is I'm not sure whether or not this leaks memory.
If so, I don't know how to make it not…

chboo1
- 63
- 9
-1
votes
1 answer
Modifying a String so that 50% of characters are uppercased and 50% are lowercased
I am attempting to create a program that will take in a simple password and generate a newer, more complex password with certain characters being changed to special characters e.g(s == $). I've got this done but I would like to have 50% of the…

Will Columbia
- 11
- 5
-1
votes
1 answer
difference of `char * str = "asdf"` and `char str[] = "asdf"` , strtok not working
my code shows the problem
this works
char str[] = "asdf=1=2=3"; // this works
printf("type: %s\n", typename(str)); // prints 'pointer to char'
char *token = strtok(str, "=");
printf("%s\n", token);
this works not , why ?
char *str2…

Jonas Frey
- 65
- 6
-1
votes
1 answer
Cannot output the C struct char array member
I'm learning how to use structures in C. But in the following code I couldn't print myArray "HELLO!" which is declared as a char array:
#include
struct myStruct
{
int myInt;
float myFloat;
char myArray[40];
};
int…

floppy380
- 179
- 1
- 8