In the code block below what's the impicit conversion that takes place in the if statement for 7? I would have though it would end up being (0x98 <= 0x07) but ... |
I am trying to compare an unsigned int with a signed char like this:
int main(){
unsigned int x = 9;
signed char y = -1;
x < y ...
|
I'm working on a homework assignment in C where we need to make a tic-tac-toe game that can be played between two players. I have all of my code working ... |
I have a quick question. I have one method called test(). And my code looks like:
void test()
{
char c;
printf("Are you happy?\n");
...
|
|
I need a way to search through a block of memory for a char[2] array "DA" using a pointer to a short. Ideally I would like to write something like: short *data = ... some data...; int j = 0; while( data[j] != *((short*) "DA") ) j++; But this doesn't work. The char[2] obviously has an equivalent 16-bit value so how ... |
|
|
|
I am learning c++, and there is a lot that i dont know, so if this is a stupid question, I am sorry. regardless, I am trying to get my program to check and see if a char value is a certain value, and then act appropriately. The compiler goes into fits when I do this, and if I double click ... |
I want to compare the commandline string with "run" and only run the app if they are equal. This however does not work even though I can see pCommandString showing as "run" in the debugger! LPSTR is #defined as a char* What am I missing? thanks INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE hInst, LPSTR pCommandString, INT) { if (pCommandString == "run") { ... |
Hello People! I hope everything's well... Im a noob coder and I have the next question, Here's my code, it copies character by character to another file. Code: #include int main (int argc, char *argv[]) { char caracter; char encrypt; char *archivaldo[20]; int cont; FILE *fp; FILE *fp2; if((fp=fopen(argv[1], "r"))==NULL) { printf("no se puede abrir"); } else { printf("si se pudo ... |
|
Whats Wrong with these 2 IFs???! Is it char comparison? Greetings from Greece to the community Im making a console programm which finds the asked words into the cryptolex by searching horizontaly But when i wrote the Search algorithm, the exe application (console) crashes despite the compiler returns no errors. Its made with dynamic 2D and 1D char Arrays containing single ... |
|
do { printf("Introduza o nome do contacto(max. 32 caracteres):\n"); getchar(); gets(contacto1.nome); printf("Introduza o nmero de telefone:\n"); scanf("%d", &contacto1.num); printf("Introduza a Data de Aniversrio(dd/mm/aaaa):\n"); // preciso implementar verificao de data correcta for(i=0;i<12;i++) { scanf("%c", &contacto1.bday[i]); } printf("Os dados so:\nNome: %s\nNmero: %d\nData de Nascimento: ", contacto1.nome, contacto1.num); for(i=0;i<12;i++) { printf("%c", contacto1.bday[i]); } printf("\nPretende guardar este contacto?(S\\N)\n"); scanf("%c", &o); }while(o!='S' || o!='s'); |
|
> fscanf(fp, "%s %c %c", arealoop, pub1loop, pub2loop); Use %s, not %c to read into a string. And strings are compared with either strcmp() or strncmp(), like you did here: if(strcmp(areatostring,arealoop)==0){/*do this when the two areas are the same*/ And it seems you could actually make arealoop an int. Then you could compare area directly with arealoop, without converting area first. ... |
|
|
__________________ Right 98% of the time, and don't care about the other 3%. It has been said that the great scientific disciplines are examples of giants standing on the shoulders of other giants. It has also been said that the software industry is an example of midgets standing on the toes of other midgets. (Alan Cooper) |
|
|
|
|