answersLogoWhite

0

Basically in c++ passing an array as an argument only provides a pointer to the first value and that function won't know how many values it has.

If you read beyond the size you will just get garbage from memory.

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

What is meant by void abcint?

void abc(int); is a function declaration. The declared function has no return value, is named abc and accepts one integer argument by value.


Where to use overloading?

Default arguments are often considered to be optional arguments, however a default argument is only optional in the sense that the caller need not provide a value for it. The function must still instantiate the argument and must assign the appropriate value to it so, insofar as the function is concerned, the argument is not optional. To implement a function with a truly optional argument, we can define two overloads of that function, one that accepts the optional argument (without specifying a default value) and one that does not accept the argument. In this way we can define two different implementations, one that uses the argument and one that does not. void f (); // implementation that does not use the argument void f (int); // implementation that does use the argument In many cases, a default argument incurs no significant overhead over that of overloading. Thus we'd only use overloading to implement an optional argument where there is a significant overhead incurred by a default argument. Even so, we must also be aware that by eliminating the overhead within the function itself we may simply be passing that overhead back to the callers, because some or all of them would then have to decide which overload to call, resulting in code duplication that would likely be best handled by the function itself.


Which take a string as input and find its length?

strlen is the C library function that accepts a pointer to a char array and returns an integer specifying the number of characters (in bytes) of the array. This function is usually not used any more, because it does not support multi-byte characters, such as UTF-8.


How do you pass a constant to a function argument that only accepts a structure?

Assuming that the argument will only accept a structure, you must place the constant inside of a structure, and use that structure as an argument. If you're using a looser language, you may be able to get away with using a constant in the place of the structure; but either way, that's bad programming practice.


How do you Write a function prototype for a function named printStars that accepts no arguments and returns no data?

void printStarts (void);

Related Questions

What is meant by void abcint?

void abc(int); is a function declaration. The declared function has no return value, is named abc and accepts one integer argument by value.


Where to use overloading?

Default arguments are often considered to be optional arguments, however a default argument is only optional in the sense that the caller need not provide a value for it. The function must still instantiate the argument and must assign the appropriate value to it so, insofar as the function is concerned, the argument is not optional. To implement a function with a truly optional argument, we can define two overloads of that function, one that accepts the optional argument (without specifying a default value) and one that does not accept the argument. In this way we can define two different implementations, one that uses the argument and one that does not. void f (); // implementation that does not use the argument void f (int); // implementation that does use the argument In many cases, a default argument incurs no significant overhead over that of overloading. Thus we'd only use overloading to implement an optional argument where there is a significant overhead incurred by a default argument. Even so, we must also be aware that by eliminating the overhead within the function itself we may simply be passing that overhead back to the callers, because some or all of them would then have to decide which overload to call, resulting in code duplication that would likely be best handled by the function itself.


Which take a string as input and find its length?

strlen is the C library function that accepts a pointer to a char array and returns an integer specifying the number of characters (in bytes) of the array. This function is usually not used any more, because it does not support multi-byte characters, such as UTF-8.


How do you pass a constant to a function argument that only accepts a structure?

Assuming that the argument will only accept a structure, you must place the constant inside of a structure, and use that structure as an argument. If you're using a looser language, you may be able to get away with using a constant in the place of the structure; but either way, that's bad programming practice.


What is the four key function of computer system?

A computer system accepts raw data, stores it, processes it and output information in a high degree of accuracy.


Electronic machine that accepts data and processes it into information?

By definition a Computer because it "Computes" and "Processes" data.


What language is accepted by the PDA for input and processing?

The PDA accepts and processes input in various languages.


What are the four steps a computer follows?

It accepts input, processes data, stores data, and produces output.


What is the climax of the story marriage proposal by Anton Chekhov?

Lomov proposes and Natalya accepts with the belssing of Chubukov. Again they pick up argument


How do you Write a function prototype for a function named printStars that accepts no arguments and returns no data?

void printStarts (void);


What is the electronic device that accepts, processes and stores dataA. Hard Drive B. ComputerC. SpeakerD. Computer System?

B.Computer


How would you write a function prototype for a function named calcAreaReact that accepts two arguments width and length and returns the area.?

double calcAreaRect (double a, double b);