C++ Basic problem

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

Replies

  • Sanyam Khurana
    Sanyam Khurana
    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?
  • Mansi Munjal
    Mansi Munjal
    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++?
  • Sanyam Khurana
    Sanyam Khurana
    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 😀
  • Mansi Munjal
    Mansi Munjal
    thanks for explaning...i get the point...@Sanyam

You are reading an archived discussion.

Related Posts

You heard it right. This is the application developed by few awesome devs which will let you download any app's apk directly on PC. Source : https://codingteam.net/project/googleplaydownloader/download/file/googleplaydownloader-1.4.tar.gz Go compile !!!
It's been several weeks since we started shipping out CrazyEngineers T-Shirts. I've been wearing it at almost all the places I went to : family functions, malls, social gatherings, seminars,...
Given that RBI controls banking in India (...and to some extent ministry of finance), how can one differentiate between banks of same class? Like two or more Nationalised banks, two...
GOI has added 4 new languages to free news SMS service. I have subscribed to English news. I am yet to get a news alert. How many of you face...
I've been a Toyota Fortuner fan for long time now but Ford's latest announcement of 'Ford Everest' got my mind changed. It looks like Everest is the new SUV to...