answersLogoWhite

0


Best Answer

All names must be declared in C so that the compiler knows what each name represents even if the definition of that name has not yet been compiled. Without a declaration, the compiler cannot know what operations are permitted upon the name and therefore cannot notify the programmer of syntax errors.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

16y ago

void, in C, is a type that has no size. Thus, if you were to declare a variable of type "void", the compiler would not know how much memory to allocate for it.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why can you not declare void variables in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the size of void data type?

Data-type void has some special features:- it doesn't have values- it doesn't have size- you cannot declare variables with it- void *pointers cannot be dereferenced


How many structure variables of a given type can you use in a C program?

You can use unlimited number of variables for a structure and you can also declare array of structures.


Examples of automatic variables in c?

Automatic variables are variables that are declared within the scope of a block, usually a function. They exist only within that scope, i.e. that block, and they cease to exist after the block is exited. These variables are usually allocated from the stack frame.


What is token in C programming?

They're things that keep the variables in line with the void main and your functions


How will you declare null pointer in C?

#define NULL ((void *)0) /* defined in <stddef.h> */ const char *mynullvar = NULL;


Why you need to declare variable 1st in turbo c plus plus?

In C++ all names (including variables) must be declared before they can be used.


Is void a data type in c?

what is void data type Void is an empty data type normally used as a return type in C/C++, C#, Java functions/methods to declare that no value will be return by the function. The another use of void is to declare the pointer in C/C++ whe It is not sure that what data type will be addressed by the pointer. eg: void *p; Here p can hold the address of int or float or char or long int or double.


How do you create methods that does not return a value?

That depends on the programming language. In C, and languages derived from C (including Java), you usually declare the return value as "void", for example: void MyMethod(int par1, int par2) { // Some commands here }


How do you declare a functions?

public void throwRock() { }


Does HTML allow you to declare integer real string and boolean variables?

HTML is not a programming language and as such does not allow you to declare variables.


whose variables are also known as global variables?

The variables which are declared outside the main() function is known as global variables and they can be used anywhere in the program. And, the variables which used declare inside the main() function is known as local variables and they can be used inside the main() function only. Example: #include<stdio.h> #include<conio.h> int x,y; // global variables void main() { int a,b; // Local variables ------------ ---------------------- --------------------- getch(); }


How do you create a class and declare a method in C?

class classname { public://access specifiers// { int a,b;//a and b are data members// void get() { printf("\n mouni no"); scanf("%d",&a); } void display() { printf("mouni no is",&a); } }; here void functions are methods