About the retrogression problem when passing a array variable into a function which takes a pointer as its argument.


folks, As the Subject suggests, array variable will retrogress as the parameter of the function actually taking pointer as its argument, like this: int f(int* i) { cout
Posted On: Monday 26th of November 2012 12:05:15 AM Total Views:  182
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




some problems about exact match in the overload resolution.

Hi . In the following program, foo is an ambiguous call. #include using namespace std; void foo(int *); void foo(int (&)[5]); int main() { int arr[5] = {0, 1, 2, 3, 4}; foo(arr); return 0; } why void foo(int ...
VIEWS ON THIS POST

256

Posted on:

Monday 12th November 2012
View Replies!

questions about virtual functions and abstract classes

, If I have a class that has virtual but non-pure declarations, like class A{ virtual void f(); }; Then is A still an abstract class Do I have to have "virtual void f() = 0;" instead I think declaring ...
VIEWS ON THIS POST

172

Posted on:

Monday 12th November 2012
View Replies!

about C++ function declaration

, I am reading the code of Tail for win32 (which is from http://sourceforge.net/projects/tailforwin32/ ), and I see something I never before. For example: void LogMessage (char* pszMessage, ...) I cannot understad the "..." thing in the param....can you ...
VIEWS ON THIS POST

105

Posted on:

Monday 12th November 2012
View Replies!

Question about creating a struct of flags in c++

Is there an efficient way to create a struct of flag in C++ I need to create a struct of boolean flag, like this: struct testStruct { bool flag1; bool flag2; bool flag3; bool flag4; bool flag5; bool flag6; bool ...
VIEWS ON THIS POST

166

Posted on:

Saturday 24th November 2012
View Replies!

simple question about NR

, all. A smple question appears when I first step into the book "numerical recipes in c++"(second edition). In page 3, the third paragraph below the code"Third, comple the main program file, and also the files flmoon.cpp and avevar.cpp,...".But where ...
VIEWS ON THIS POST

175

Posted on:

Saturday 24th November 2012
View Replies!

how can i write the iterator about my struct

struct nodeType { int v, index; }; list node[1000]; for(list::iter = node[q[qIndex]].begin(); iter != node[q[qIndex]].end(); iter++) What's wrong with it how can i fix it...
VIEWS ON THIS POST

199

Posted on:

Sunday 25th November 2012
View Replies!

Q. about POD with const member (or g++ vs. Comeau)

Given the following: // ++ CODE struct S { const int ci; }; int main() { S * s = new S; } // -- CODE Comeau Online gives me: // ++ output Comeau C/C++ 4.3.10.1 (May 29 2008 09:37:15) ...
VIEWS ON THIS POST

91

Posted on:

Sunday 25th November 2012
View Replies!

basic question about returning strings / char arrays

Hi everybody, have a quick look at this code: ===== ===== int main(void) { string msg; makeString(msg); cout << "back in main, result = " << msg << endl; return EXIT_SUCCESS; } void makeString(string& message){ char theMessage[25] = "Here is ...
VIEWS ON THIS POST

111

Posted on:

Sunday 25th November 2012
View Replies!

c++ primer statement about vectors containing vectors

C++ Primer by Lippman, Lajoie and Moo seems to object to code like std::vector> something; The concern is that >> will be interpreted as a shift operator and the code will not compile. However, I have seen no problems with ...
VIEWS ON THIS POST

101

Posted on:

Sunday 25th November 2012
View Replies!

A problem about char pointer ?

this is a sample example about this question #include void chg(char* t) { char *s=t; char p=*t; while(*t++=*++s); *--t=p; } int main() { //char * t="abcde"; char t[]="abcde"; chg(t); printf(t); printf("\n"); return 0; } I want know why the function ...
VIEWS ON THIS POST

149

Posted on:

Sunday 25th November 2012
View Replies!

Re: help me ! , about Binary Search Tree

, bushido wrote: > bstree.hpp > > #ifndef DSALAB_BSTREE_HPP > #define DSALAB_BSTREE_HPP > > #include > > template > struct Bst_node { > public: > typedef T_ value_type; > > Bst_node* left; > Bst_node* right; > value_type data; ...
VIEWS ON THIS POST

120

Posted on:

Sunday 25th November 2012
View Replies!

Question about Name Hiding concept

Hi I have a question regarding this concept I learned about recently: Name Hiding. Here's what I've come across: There is a base class with two functions with the same name but different signature. A class inherits publicly from this ...
VIEWS ON THIS POST

60

Posted on:

Sunday 25th November 2012
View Replies!

about dwAllocationGranularity of SYSTEM_INFO

, I read the description of dwocationGranularity from, 1. http://msdn2.microsoft.com/en-us/library/ms724958.aspx 2. http://msdn2.microsoft.com/en-us/lib...87(VS.85).aspx and tested on my system it is 65535. But from the above description, I do not quite understand what does it mean. Does it mean that when ...
VIEWS ON THIS POST

86

Posted on:

Sunday 25th November 2012
View Replies!

Hi, i have information about C, C++ and Java language, download now

hi, i want to share my information with you. this is many ebook about java,C, or C++, download from there site. the address is http://freepdf-ebook.blogspot.com/...
VIEWS ON THIS POST

87

Posted on:

Sunday 25th November 2012
View Replies!

about unary_function

, I am wondering what is the practical usage of unary_function Could anyone list some practical benefits My question is, a class like class Foo : public std::unary_function is always the same (could use similar implementation) ...
VIEWS ON THIS POST

66

Posted on:

Sunday 25th November 2012
View Replies!

question about atoi

The following description of atoi is pasted from cplusplus.com. My question is after the pasting. ***** PASTING BEGINS HERE ****** int atoi ( const char * str ); Convert string to integer Parses the C string str interpreting its ...
VIEWS ON THIS POST

166

Posted on:

Sunday 25th November 2012
View Replies!

>" overloading" style="color:#1385b4;text-transform:uppercase;" name="Post_227673"> A Problem about istream ">>" overloading

It seems that the problems have something to do with the overloading of istream operator ">>", but I just can't find the exact problem. // the declaration friend std::istream & operator>> (std::istream & in, const Complex & a); // the ...
VIEWS ON THIS POST

28

Posted on:

Sunday 25th November 2012
View Replies!

Question about stdlib.h system()

Hi all, I'm using system to invoke a script remotely on another machine. Something like this: system("/putty/plink.exe" 10.0.0.25 /home/foo); The problem is, sometimes the foo script freezes the remote machine's OS and system does not give control back to my ...
VIEWS ON THIS POST

78

Posted on:

Sunday 25th November 2012
View Replies!

A question about multiple inheritance in C++!

In the following function: #include using namespace std; class V { public: V() {cout << "V()" << endl;}; V(int) {cout << "V(int)" << endl;}; }; class A: virtual V { public: A(){}; A(int){}; }; class B: virtual V { ...
VIEWS ON THIS POST

156

Posted on:

Sunday 25th November 2012
View Replies!

2 basic questions about types and strings

, first of all I have a question about types: When I have a method like this... TYPE getStringValue() { string str = "test"; return str; } ....TYPE can't be "string" because "string" is no basic type. I made some ...
VIEWS ON THIS POST

165

Posted on:

Monday 26th November 2012
View Replies!