Yes. Use a control parameter before the variable argument list that determines how many arguments will follow. E.g., the printf() function uses a string parameter as the control parameter. The number of escape sequences in the string determines the number of arguments that are expected to follow, and each escape sequence in the string is expanded from left to right according to the arguments that follow. A simpler approach is to pass the number of arguments that will follow as a named argument. E.g.,
void print_nums(int n, ...)
{
// n tells you how many numbers are to be expected in the va_list.
}
Answer
Yes, there can be solution.
#1: explicitly specifing:
extern void variadic_1 (int n, ...);
variadic_1 (3, "first", "second", "third");
#2: using terminator:
extern void variadic_2 (...);
variadic_2 ("first", "second", "third", NULL);
How do you make an input program that computer can determine the highest number?
Here it is in Java for 5 numbers: (adapt for your programming language)
import java.util.Arrays
Public class Highestnumber
{
public static void main (String args[])
{
Scanner input = new Scanner( System.in );
int numberofinputs = 5;
//make an array to hold the numbers
int numbers[] = new Int[numberofinputs];
for (x=0;x<numberofinputs;x++)
{
System.out.print("Please input a number: ";
numbers[x] = input.nextInt();
}
//Sorts Numbers from least to greatest
Arrays.sort(numbers[]);
//gets highest number
int highestnum = numbers[numberofinputs-1]
//displays highest number
System.out.println("The highest number is:" + highestnum);
}
}
Which topology has the most fault tolerance and redundancy?
The star bus topology has the most fault tolerance.
What is the difference between structures in C and structures in CPP?
A struct (structure) is the same, whether you use C or C++, so, depending on your point of view, there is no difference.
In C++, however, a struct is a class that has no methods, not even a constructor or destructor (except for the default ones), and its default inheritance model is public instead of private.
Write a java program to show following pattern 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1?
// num = the highest number to start with
final int num = 5;
// Go through each value from num through 1.
for (int n = num; n > 0; --n) {
// For each value, print each value from num all the way down to the value.
for (int m = num; m >= n; --m) {
System.out.print(m);
System.out.print(' ');
}
}
Learn C! :-)
There are several functions in C that can be used to read input from the user, such as getc(), getchar(), and scanf(). Files can be written to using fprintf() and putc(). They can be opened with fopen() and closed with fclose().
Such specialists are usually paid to do work for others. They may have signed a contract stating that the work they get paid to do doesn't belong to them; even if they didn't sign such a contract, it is usually implicit. For more information, read the Wikipedia article entitled "Work for hire".
Difference Between RPC and RMI?
The only real difference between RPC and RMI is that there is objects involved in RMI: instead of invoking functions through a proxy function, we invoke methods through a proxy.
What this means in practice is that we now want the client to hold references to remote objects that it can invoke methods on. These references should behave just like local objects, but when invoked dispatch the method invocation to the remote object.
Because we need to refer to both an object and a method now - not just a function - we extend the protocol so it first sends an object id across the socket, then the method and then the arguments. The server then dispatches the method to the remote object based on id and method name.-Rituparno Ganguly
What is the built in function to draw lines in Visual C plus plus?
C++ has no built-in function to draw lines, nor indeed to perform any type of graphics output. The standard library is designed to be as generic as possible, and is therefore capable of supporting all platforms using text output only. Graphics output is obviously possible, but it is platform-specific so you will need a graphics API that provides functions that are specific to your operating system and/or hardware.
Which characters are not allowed in a file name?
This page website contains list of characters not allowed in a filename on windows, mac, Linux/unix
http://www.comentum.com/File-Systems-HFS-FAT-UFS.HTML
What is procedure given in class to convert binary to hex?
Split the binary value into groups of 4 bits (half-a-byte). Translate each nybble to its corresponding hex digit. Use the following table to translate each nybble:
0000 = 0x0
0001 = 0x1
0010 = 0x2
0011 = 0x3
0100 = 0x4
0101 = 0x5
0110 = 0x6
0111 = 0x7
1000 = 0x8
1001 = 0x9
1010 = 0xA
1011 = 0xB
1100 = 0xC
1101 = 0xD
1110 = 0xE
1111 = 0xF
What does solution oriented mean?
On a basic level it means someone focuses on the solution to a problem more than the problem itself. There are several ways to perceive situations. When someone is solution oriented those people perceive problems as ways to come up with great solutions in order to make a problem into an actual benefit.
In pointers to store float address is we can use integer variable?
You can't address memory with floating point values. All pointers are integer values pointing to a location in memory, regardless of what type it is pointing to. If you wanted a floating point pointer, then the following should do the trick:
float *floatingPointer;
Note: If you wanted to ask that which integer type is big enough to hold a (flat) pointer, then the answer: ptrdiff_t, intptr_t (both signed) and size_t, uintptr_t (both unsigned).
How do you declare an N-Dimensional array using Malloc?
#include <stdlib.h>
int **array1 = malloc(nrows * sizeof(int *));
for(i = 0; i < nrows; i++)
array1[i] = malloc(ncolumns * sizeof(int));