2 Questions
Ok, people, I have two questions.
1) I have the following bit of code in one of my programs:
6 int number[99][2];
7 number[0][0] = 1;
8 number[0][1] = 1;
Note that the 6, 7, and 8 aren''t in my code...I''m just indicating line numbers. I get numerous error messages for all of these lines, like:
6 ch.8-2,#38_main.cpp
previous declaration as `int number[99][2]''
7 ch.8-2,#38_main.cpp
invalid initializer
7 ch.8-2,#38_main.cpp
ANSI C++ forbids declaration `number'' with no type
8 ch.8-2,#38_main.cpp
conflicting types for `int number[0][1]''
I don''t know why I''m getting these. The only thing in the program I''ve done before declaring number[][] is declare other variables (and none of them are called ''number'').
2) How would you pass an integer to an argument with a char type (more specifically, the strcat() function).
Thanks!
1: sounds like you have code outside functions. move your assignments into functions to fix those errors.
2: you can't. use sprintf, itoa, ostringstream, or some other method to convert the number to a string, then strcat() the string.
[edited by - niyaw on October 22, 2002 1:33:30 AM]
2: you can't. use sprintf, itoa, ostringstream, or some other method to convert the number to a string, then strcat() the string.
[edited by - niyaw on October 22, 2002 1:33:30 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement