# Questions regarding functions

Discussion in 'C' started by gabuchia, Oct 4, 2009.

1. ### gabuchiaNew Member

Joined:
Oct 4, 2009
Messages:
11
0
Trophy Points:
0
Good day guys, this is my first time posting, so if there is anything I should know about this particular forum, please do let me know!

I have tried searching on the internet, but do you guys know what does this line do?

istringstream is(Expr);

if(Expr.at(i)=='(') p++;

return Value_Of_Expr(Expr.substr(0,i))+Value_Of_Expr(Expr.substr(i+1,Expr.length()-i-1));

These three lines have something I don't understand, such as :

istringstream is(XX) - What does it do?

if(Exr.at(i)=='(') p++;

return Value_Of_Expr(Expr.substr(0,i))+Value_Of_Expr(Expr.substr(i+1,Expr.length()-i-1));

2. ### xpi0t0sMentor

Joined:
Aug 6, 2004
Messages:
3,012
203
Trophy Points:
63
Occupation:
Senior Support Engineer
Location:
England
When you post, there are posting guidelines, including how to post code. READ THEM PLEASE.
They're not easy to miss.

istringstream is(XX) creates an istringstream object named is, using a constructor that takes an XX as its argument, so it creates an istringstream from an XX.

Code:
```if(Exr.at(i)=='(') p++;
```
The brackets may be confusing you; let's add some space to clarify:
Code:
```if(    Exr.at(i)  ==  '('    ) p++;
```
So this calls Exr.at, passing in i, which returns a character, which the == compares with an open bracket. So this appears to be doing some kind of analysis of nested expressions where brackets are used for nesting.

3. ### gabuchiaNew Member

Joined:
Oct 4, 2009
Messages:
11
```istringstream is(Expr); double value=0.0; is >> value; return value;```