Best way to check if a character array is empty?

Which is the most reliable way to check if a character array is empty? char text[50]; if(strlen(text) == 0) {} o...

Unclosed Character Literal error?

Got the error "Unclosed Character Literal" , using BlueJ, when writing: class abc { public static void main(Stri...

Can the char type be categorized as an integer??

Just now I read "char is the only unsigned integral primitive type in Java." Does this mean the char is one of the i...

Process exited prematurely with a SIGSEGV signal?

This code shows this SIGSEGV error, which I understand, is a segmentation error. Can someone please help! The code r...

Check if a string contains only a set of letters?

I'm trying to check if a word contains only a set of letters such as I,O,S,H and X Suppose the user enters: SSHX, th...

std::string to char*?

I want to convert a std::string into a char* or char[] data type. std::string str = "string"; char* chr = str; Re...

Counting number of occurrences of a char in a string in C?

I have the string str char *str = "100.10b.100.100"; I want to count the occurrences of '.' in str, preferably a ...

expected expression before ‘{’ token?

Why am I getting this error and how to I resolve it? void add(struct Data* data,char* name, char* hobbies[]) { ...

2D character array initialization in C?

I am trying to build a list of strings that I need to pass to a function expecting char ** How do I build this arra...

Is there a function in c that will return the index of a char in a char array??

Is there a function in c that will return the index of a char in a char array? For example something like: char va...

How can I convert const char* to string and then back to char*??

I'm just starting c++ and am having difficulty understanding const char*. I'm trying to convert the input in the met...

SQL query for a carriage return in a string and ultimately removing carriage return?

SQL query for a carriage return in a string and ultimately removing carriage return I have some data in a table and...

Allocating char array using malloc?

Hi recently I saw a lot of code on online(also on SO;) like: char *p = malloc( sizeof(char) * ( len + 1 ) ); W...