-
inline void
is there any difference in inline void and void?
because i have noticed that
Code:
#include <iostream>
using namespace std;
inline void hello()
{
cout<<"hello world"<<endl;
}
int main()
{
hello();
cin.get();
}
will do the same if i leave out inline
Code:
#include <iostream>
using namespace std;
void hello()
{
cout<<"hello world"<<endl;
}
int main()
{
hello();
cin.get();
}
-
why don't you look up 'inline'
-
Yes, they both are different.
inline void hello() will result in the function call being replaced by the definition during compile time. Hence there will be no overhead involved in pushing the contents to and from the stack that happens in the normal function call.
PS: the functions defined within the class definition is treated as inline. EG:
<<< UNTAGGED CODE DELETED :mad: :mad: :mad: :mad: >>>
Inline functions will reduce the function time if the function is not complicated.
-
i have it doesnt say if it makes a differnce to the program
and does anyone know how to fix this program
Code:
#include <iostream>
#define IsVowel('a'||'i'||'o'||'u')
using namespace std;
int main()
{
char letter [256];
cout<<"enter a letter"<<endl;
cin.getline(letter, 256);
if(strcmp(letter, 'IsVowel')==0)
{
cout<<"its a vowel"<<endl;
}
else cout<<"its not a vowel"<<endl;
cin.get();
}
-
You can try this out. It works.
<<< UNTAGGED CODE DELETED >>>
-
Inline doesn't make any difference to your program except that it reduces the exceution( run) time.
-
ah ok and
Code:
if ( strchr( ISVOWEL, x ) )
compares ISVOWEL with x?
-
It doesn't compare. It returns pointer to first occurrence of x in ISVOWEL string.