Can struct be declared in the main function?
Type: Posts; User: zouyu1983
Can struct be declared in the main function?
when i confront this situation, i often allocate a large enough space in the stack or the heap to store the data.
or you can use the dynamic array for this. input the data into the dynamic array...
the best way to learn language is to program.
i think it will be very helpful to do some acm excrcises.Although it focus on the algorithms,you will improve your skill of the language when you...
the first case : the compiler will call the copy-constructor to construct a temp string which the value is the same as the test, and when the function ends, the compiler will call the destructor
to...
>> I've written some code for my class without them and it worked really fine
The compiler will create a default constructor for you if you don't creat any,but the constructor that the compiler...
please do your best to implement the code first, then if your code doesn't work correctly, then post it and we will glad to help you
i like searching algorithms
Oh, sorry, i didn't see it clearly.
the someclass_2 is a member of the smoeclass_1 because you declare it in the someclass_1, so when you define the someclass_2,you must write it like the style...
Sorry, but I don't quite understand what the "Boost.Thread" means?
if you want to make the class someclass_2 the friend class of the someclass_1, you must declare it first, otherwise the compiler will not know what the someclass_2 is.
but in someclass_2, you can...
I'm confusing how to pass a argument into the thread function.After studying some documents about the thread, i wrote a program which could run correctly about the argument passing.But i feel that...
char *p = "i come from china";
does it allocate in the stack,or static area of the memory?
does the standard define the behavior that modifys the value of the string like this?
thanks
all the parameter is passed by value,look at the program below
#include <iostream>
#include <string>
using namespace std;
void create(string* x)
{
i'm sorry, the output of the program is undefined
now give the answer i test
in windows xp sp2 vc.net 2003, the output is:
98012345980123456789
980123456789
6789
in windows xp sp2 g++, the...
you mean that in ANSI C++ , there is no guarantee aboult it?
maybe i make mistakes.
i will review the standard.
anyway, thanks^_^
you can try it ^_^, and i am sure the output is unique without induring any problem
the standard make guarantee of the global variables being stored contiguously in the static area of the memory
the output is unique
and the program will not induce a runtime error
just give the ouput of the program
the program runs correctly
hi,guys, i saw a interesting program today,the source code is:
#include <iostream>
using namespace std;
char a[] = "abcdefg";
char b[] = "1234567";
char c[] = "980123456789";
do you know chinese?
d:\My works\VC++.NET 2003 WORKS\Workplace\test\test.c(10) : warning C4013: “printf”未定义;假设外部返回 int
d:\My works\VC++.NET 2003 WORKS\Workplace\test\test.c(29) : warning C4013: “scanf”未定义;假设外部返回 int...
i'm not good at english, you may not understand the words i written,so i thinked the code is the best way to express my thought.
sorry, i will do my best to explain , and not just post the code
oh, that's my mistakes, when i found scanf("%lf",.....) will eliminate the error, i change the float to double, and send the code to my GF, but before i post the code , i change the double to the...
oh,sorry, i deleted the [i] uncarefully when i post the code
my source code is scanf("%f", &stuArray[i].chinese) .........
and it take runtime error
but change them to scanf("%lf",....) , the...