Search:

Type: Posts; User: gaurav#

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. The reason behind it is not given hence the...

    The reason behind it is not given hence the question is asked.
  2. This warning can only hide a linker error of...

    This warning can only hide a linker error of multiple definition which doesn't stand in this case. focus on this: how these definitions: int K=898 & extern int K=898 are different at function scope.
  3. Check this out: #include using...

    Check this out:



    #include <iostream>
    using namespace std;

    extern int k =89;

    int main() {
  4. Initializing an extern variable defines that -...

    Initializing an extern variable defines that - the question is why definition - extern i =898; is different from definition - int i =898;
  5. extern variable throwing : "has both ‘extern’ and initializer" error

    The code is throwing error despite 'i' being defined after initialization, why?



    #include<iostream>


    using namespace std;
  6. the point of issue is: in code 1 the integer...

    the point of issue is: in code 1 the integer returned by toupper is rejected for initialization and in code 2 it is accepted -> in both the cases strings are involved.

    maybe this clears better...
  7. nope, I am doing exactly what I have done, i.e....

    nope, I am doing exactly what I have done, i.e. direct initialization of string 's' in code 1 and conversion to upper case in code 2.
  8. The error message when I use toupper(t[0]) is: ...

    The error message when I use toupper(t[0]) is:


    without using it, it is:
  9. please explain me the different behaviours related to toupper/string

    in this 1st code t[0] return 'char' so the compiler throws an error illegal conversion from 'char' to 'const char*' :




    //CODE 1

    #include<iostream>
    #include<vector>...
  10. Why there is discrepancy in sizeof output?

    #include <iostream> //CODE 1
    using namespace std;


    int main() {
    char c[]="Hello"; //C-style string
    cout<<sizeof(c);
    return 0;
    }
  11. sizeof(String) returns 8/32 on two different compilers.

    Hi, why the same code is having two different outputs (read it further):



    #include<iostream>
    #include<string>


    using std::cin;
    using std::cout;
  12. I understand the cin-cout part but the comma...

    I understand the cin-cout part but the comma seprating them is not clear, what functionality it adds?
  13. One solution I got to take the input as String...

    One solution I got to take the input as String and then make a function to do the conversion job somewhat on the lines on atoi function but with base 8 for octal.

    Apart from this can you please...
  14. Why this code is throwing re-declaration error on using extern?

    Since any variable can be declared multiple times & this underlying code is allocating memory only once, so why the re-declaration error?



    int main(){ //code 1
    externint i;
    ...
  15. Why there is a difference between working of these nearly same codes involving input?

    #include<iostream> //Call it 1st

    using namespace std;


    int main()
    {
    int i=019;
    cout<<i<<endl;
    return 0;
  16. Replies
    2
    Views
    848

    Reading a class object with cin.

    I have used member variables and operated on them with the help of member functions. Bu in one of the examples in C++ Primmer i found something like this:



    Sales_item book; \\book...
  17. Replies
    4
    Views
    704

    in 1st shouldn't it throw some error since the...

    in 1st shouldn't it throw some error since the operator << sends its right-hand-operands i.e. "hello") into the left hand operand i.e. ostream object cout & it should be asking for the...
  18. Replies
    4
    Views
    704

    Question regarding cout

    why does these two statement behaving in the same manner?


    (cout<<"hello"); //1st




    cout<<"hello"; //2nd
  19. SORRY I had type the code on a cell phone which...

    SORRY I had type the code on a cell phone which lead to few auto-corrects along with some missing parts, here is the complete code:



    #include<iostream>
    using namespace std;

    class a{
    int...
  20. Replies
    11
    Views
    2,199

    Please paste the code as the link you have shared...

    Please paste the code as the link you have shared is not working
  21. Question regarding pointer, which points to typecasted object of a class

    When a pointer points to an object of any class which is typecasted to that type, does it make the arguments of constructor behave like an array?


    #include<iostream>
    using namespace std;
    ...
  22. Queries regarding virtual pointer and virtual function

    1: If the base class has a virtual function and
    then the derived class also has function under the same name, is it possible that even the derived class will have a virtual table despite the common...
  23. Replies
    5
    Views
    3,195

    char x[6]="hello"; char s[]=" world";...

    char x[6]="hello";
    char s[]=" world";
    strcat(x,s);


    Despite not giving enough space to x this code is giving output as "hello world". Why?
  24. Replies
    5
    Views
    3,195

    Now even on changing the code tho this, once it...

    Now even on changing the code tho this, once it had printed " worldhello" but rest of the times it said runtime error.



    #include<studio.h>
    #include<string.h>

    int main()
    {
    const char...
  25. Replies
    5
    Views
    3,195

    Why strcat is not working in this case?

    This is throwing a runtime error


    #include<studio.h>
    #include<string.h>

    int main()
    {
    const char *x="hello";
    char *s=" world";
Results 1 to 25 of 80
Page 1 of 4 1 2 3 4