since, the word 'void' in C Programming language means that it does not return any value to the user or calling function....this is usually used to specify a type of function...... for this reason w use 'void'in c program..
void main() { int a = 5; int b = 7; int c = 2; int res; res = (int)(a/b)?a:b; res = (int)(res/c)?res:c; printf("big num = %d",res); }
void simply means you don't have anything to return w/in a function, it is the same as return 0; public void sample() { MessageBox.Show("This Function do not return anything"); }
#include <stdio.h> int main (void) { puts ("Marry me"); return 0; }
#include<iostream.h> #include<conio.h> void main() { int num_last,res=0; cout<<"Enter the last number : "; cin>>num_last; for(int i=0;i<=num_last;i++) res=res+i; cout<<"Result is "<<res<<endl; getch(); }
c++
You don't use 'VOID', but 'void'. It means different things, such as:- void as function type means no return value- void as function parameter means no parameters- 'void *' as pointer-types means generic pointer
void main() { int a = 5; int b = 7; int c = 2; int res; res = (int)(a/b)?a:b; res = (int)(res/c)?res:c; printf("big num = %d",res); }
In C-programming: int main (void) { return 0; }
Not all host environments make use of a C program's return value, thus some implementations still allow the void main function signature. C++ does not permit it, however. All C++ programs must return an integer whether the environment uses it or not.
void simply means you don't have anything to return w/in a function, it is the same as return 0; public void sample() { MessageBox.Show("This Function do not return anything"); }
#include <stdio.h> int main (void) { puts ("Marry me"); return 0; }
They're things that keep the variables in line with the void main and your functions
It doesn't. Void has the same meaning in both.
int main (void) {puts ("day is holyday");return 0;}
#include<iostream.h> #include<conio.h> void main() { int num_last,res=0; cout<<"Enter the last number : "; cin>>num_last; for(int i=0;i<=num_last;i++) res=res+i; cout<<"Result is "<<res<<endl; getch(); }
The logic to create such programs is very simple. We know that rules of programming languages. Among them the most important one is "We should not use keywords as identifiers". Based on this rule we can create many programs that execute in c but not in cpp. Suppose write a program to and two numbers. Store the two values in two variables, name the variables as class and object. then execute in c. it will produce the output, and do the same thing in cpp, it will give two errors. because we used keywords as identifiers in cpp. ex:-#include<stdio.h> #include<conio.h> void main() { int class=10,object=26,res; res=class+object; printf("%d",res); getch(); } Or: char str3[3] = "ABC"; /* doesn't compile in C */
Is this question about programming? If so, try this:int main (void) { puts ("ABC"); return 0; }