CrazyEngineers
  • C++ Basic problem

    Updated: Oct 22, 2024
    Views: 1.4K
    Q:-1)Is there any difference between
    Void getdata(void) and void getdata() in c++???
    Q:-2)In C,
    void display()-empty parantheses implies any number of argument.this is also true in c++???
    pls reply
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Sanyam Khurana

    MemberNov 1, 2014

    Mansi Munjal
    Q:-1)Is there any difference between
    Void getdata(void) and void getdata() in c++???
    No, if you specify void, it simply means that it requires no argument and would be equivalent to second form. And yeah, the first function would be void getdata(void) not Void getdata(void)

    Remember C/C++ is case sensitive.

    Mansi Munjal
    Q:-2)In C,
    void display()-empty parantheses implies any number of argument.this is also true in c++???
    pls reply
    I would first like to know how come this display() function can accept any no. of arguments in C?
    Are you sure? This action cannot be undone.
    Cancel
  • Mansi Munjal

    MemberNov 1, 2014

    i
    Sanyam Khurana
    No, if you specify void, it simply means that it requires no argument and would be equivalent to second form. And yeah, the first function would be void getdata(void) not Void getdata(void)

    Remember C/C++ is case sensitive.



    I would first like to know how come this display() function can accept any no. of arguments in C?
    i read somewhere that in C,if a function declared with an empty parentheses then in function definition we can pass any number of arguments.i want to know that is true in c++?
    Are you sure? This action cannot be undone.
    Cancel
  • Sanyam Khurana

    MemberNov 1, 2014

    Mansi Munjal
    i

    i read somewhere that in C,if a function declared with an empty parentheses then in function definition we can pass any number of arguments.i want to know that is true in c++?
    Your concepts are absolutely wrong!

    Please tell me more about this Declaration and Definition thing.

    See, you declare a function so as to tell the compiler that this particular kind of function would be used.

    You define it, in order to implement the logic you want that module to execute.

    Empty parentheses means no arguments, and hence if declaration says your function would have no argument, then how can you define a function with arguments?

    It's just like saying Hello, My name is Mansi, I don't use internet.

    Then somewhere in definition you say, Hello My name is Mansi, I use CrazyEngineers.

    The declaration and definition goes hand in hand.

    PS: Please keep this explanation this time, I've my exams I would clear this entire thing after 10th! 😁

    Till then, why don't you use Google 😀
    Are you sure? This action cannot be undone.
    Cancel
  • Mansi Munjal

    MemberNov 1, 2014

    thanks for explaning...i get the point...@Sanyam
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register