Questions tagged [void]

An incomplete type used as syntactic place-holder for the return type of a method/function when no value is returned.

Programming languages derived from C or Algol68, like C++, C#, Java, etc., may define the return type of methods/functions as void when the method/function does not return a value, but simply completes execution.

An example of its use in Java, compared to a non-void method, is:

int nonVoidMethod {
    // do something
    return 0; // return a value to the caller
}

void voidMethod {
    // do something
    return; // no value allowed to be returned from a void method
    // a "return" statement is not required
}

Although void is used as a type, it's an incomplete type:

  • In some languages, such as Java and Algol68, void is only a keyword used as a return type. It is not considered as a valid type in other language constructs.

  • Other languages, like C and C++, consistently define void as a type with an empty set of values. This allows its use for example in compound type constructs (void pointers). But no void objects can be instantiated.

1913 questions
0
votes
2 answers

Sending values to a sound driver (const void) in C

Im trying to stream values from an buffer, these values are being generated by a sine wave function When i try to send the values to the driver i have to use this function snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, …
user2459764
  • 85
  • 1
  • 2
  • 7
0
votes
1 answer

How to run a function on Create of the app

i'm trying to run this function: public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException { DocumentBuilderFactory domFactory = …
user1932813
0
votes
1 answer

Objective-C undeclared indentifier

I'm an Objective-C beginner and I'm not sure where it went wrong so some help would be greatly appreciated. The warning reads "use of undeclared identifier 'update'" - (void) update { NSTimeInterval secondsSinceLastDraw =…
sonder
  • 1
  • 1
0
votes
1 answer

read text file then add character to list?

So I'm trying to complete this part of a program where I have to read a text file from Stdin and add it to the 'word list' wl. I get how to read from a text file but I don't know how to go about adding 'words' to a list, if that makes sense. So…
0
votes
2 answers

how to scan items in to an array of void*?

I have 2 pointers declared like this: void *arr1,*arr2; I'm going to dynamically allocate memory for these 2 pointers and then scan some input to them. For instance, for the 1st one i do this: scanf("%c",&typ); scanf("%d",&len1); The user enters…
Alaa M.
  • 4,961
  • 10
  • 54
  • 95
0
votes
1 answer

Best way to call a method in a different view?

So I am going to get straight to the point. I need from one view controller (FolderViewController) to be able to call a -(void) on my other view controller (MainViewController). The method I want to call will refresh the servers based on which…
user2284295
0
votes
5 answers

what is the practical use of void datatype and void pointer?

Void variable has nothing to do and also void pointer can only be pointed with casting. So void pointer is used when we actually don't know where and of which data type we want to point. But what is of void variable? Any practical example?
Vikrant Patel
  • 17
  • 1
  • 7
0
votes
1 answer

Updating row directly in ASP.NET using databind() ! Please help me

This is a difficult problem so I found how to solve when cell on table don't receive input value from user . Please show me how retrieve value from updated cell . Please help me . I am very boring because of seeing this problem protected void…
0
votes
2 answers

OCMock test for void methods

I am doing OCMocktest for methods that will return some value. How to implement for void methods. Eg a method that calculates Simple interest. But it doesot return any value. How can check the calculation functionality? -(void)calculateSI { float…
Warrior
  • 39,156
  • 44
  • 139
  • 214
0
votes
3 answers

void Name(type name1,type name2, type name3[name1][name2] );

I don't know why my Microsoft Visual C++ 2010 Express doesn't support a code like this: void ar(int n,int m, short ar[n][m]); The thing that happens is that the letter n and m gets undercovered in red and it says: //Error: a parameter is not…
user2283719
  • 153
  • 2
  • 10
0
votes
2 answers

C - pointer problems and void method problems

I have problems with the following code in C. Basically I want to create two threads and give them both the integer value of "ergebnis" . After this the threads should have to calculate on this value seperately and print their individual…
Timo Ed
  • 3
  • 2
0
votes
1 answer

Why not void is a datatype in C?

Today one student came to me and asked me, sir we have int, float, char and all datatypes in C. when we write int i, that means i is an variable of type integer and so on for float f and char c. Similarly we have int *i means i is a pointer to an…
Rasmi Ranjan Nayak
  • 11,510
  • 29
  • 82
  • 122
0
votes
2 answers

Using "ccsequence" for "dismissViewControllerAnimated" and once it will be dismissed, "replaceScene"

G'day, I have a small question. I'd like to use ccsequence for replacing current running scene with another one just after the view controller will be dismissed, would be nice to have something like that: id test = [((AppController *) [UIApplication…
0
votes
3 answers

expected unqualified-id before 'void'

I am newbie in C++ programming but also have a need to use C++ code to calibrate interest tree in Black-Derman-Toy model. In book "Modeling Derivatives with C++" have found needed source code. However it didn't work. I know that this error was…
Ascorpio
  • 196
  • 1
  • 3
  • 14
0
votes
1 answer

Android: from surfaceview back to the menu

I am making a simple game in which I draw a set of bitmaps on a Canvas on SurfaceView. Now in my main activity I have a LinearLayout where I have designed a button. In the onClick() of this button I write: setContentView(new…
Samarth
  • 47
  • 5
1 2 3
99
100