Archived

This topic is now archived and is closed to further replies.

2 Questions

This topic is 5534 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites