Are function prototypes necessary in C and Cpp?
Yes. Without prototypes you must ensure all definitions are declared forward of their usage. This isn't always possible. Separating the prototypes from the definitions means you can #include the prototypes forward of their usage, and place the actual definitions anywhere you like.
What is parameter in functions?
whatever the variables we declare in function signature to receive the arguments at the calling that are known as parameters..
e.g.
int sum(int a,int b);
here a & b are known as parameters.....
How do you convert char array into unsigned char array in c?
You can't convert the data type of any variable.
How to you write a program in with decimal values?
In C, decimal values are called "floating point" because the number of digits after the decimal point can vary. There are two types used for floating point operations: float and double.
Although the decimal point can shift anywhere within the number, C only allows a certain number of consecutive digits worth of precision. The float type only allows 7 consecutive digits, and the double type allows 15. Any digits before and after those consecutive digits are generally displayed as zero (0).
Here's an example program that uses the float type with arithmetic operators:
#include
void main()
{
float myfloat=0.0, counter;
printf("* perform addition on the float:\n");
for (counter=5; counter<10; counter++) {
myfloat+=(counter/10);
printf("myfloat is: %0.7f\n", myfloat);
}
printf("* perform subtraction on the float:\n");
for (counter=0; counter<5; counter++) {
myfloat-=(counter/10);
printf("myfloat is: %0.7f\n", myfloat);
}
printf("* perform multiplication on the float:\n");
for (counter=5; counter<10; counter++) {
myfloat*=(counter/10);
printf("myfloat is: %0.7f\n", myfloat);
}
printf("* perform division on the float:\n");
for (counter=2; counter<8; counter++) {
myfloat/=(counter/10);
printf("myfloat is: %0.7f\n", myfloat);
}
}
The %0.7f inside the printf() format string tells the compiler you want to display a minimal number of integer places, and no more than 7 decimal places. Play around with this value and see what happens.
If you compile and run this program, you may notice something odd. The last (right-most) decimal place has an errant number popping in. This is a result of the low precision of the float type. The following output is an example:
* perform addition on the float:
myfloat is: 0.5000000
myfloat is: 1.1000000
myfloat is: 1.8000001
myfloat is: 2.6000001
myfloat is: 3.5000002
* perform subtraction on the float:
myfloat is: 3.5000002
myfloat is: 3.4000003
myfloat is: 3.2000003
myfloat is: 2.9000003
myfloat is: 2.5000002
* perform multiplication on the float:
myfloat is: 1.2500001
myfloat is: 0.7500001
myfloat is: 0.5250000
myfloat is: 0.4200000
myfloat is: 0.3780000
* perform division on the float:
myfloat is: 1.8900001
myfloat is: 6.3000002
myfloat is: 15.7500000
myfloat is: 31.5000000
myfloat is: 52.5000000
myfloat is: 75.0000000
However, if you're displaying only a couple of decimal points, the discrepancy is generally unseen.
What do you do in order to access the run program?
#include<stdio.h> void main() {int k=10; prinft("%d,"&k"); }
What is the size of null pointer?
A NULL pointer has the same size as a non NULL pointer. NULL means that the pointer has been set to the NULL value that is usually zero (0) but the NULL value is at the digression of the compiler manufacture (and may have a value other than zero) so a pointer should always be set to the NULL value and not zero.
Current compilers (32 and 64 bit, Intel chip) have a pointer size of 4 (8 bit) bytes.
It should be noted that the number of bits in any data type is at the compiler manufactures digression but is heavily influenced by the computer hardware.
void *p= NULL;
printf ("%d\n", sizeof (p));
or
printf ("%d\n", sizeof (void *));
How do you close a string literal?
Just as you have started it.
good examples:
'string'
"string"
`string`
»string«
bad examples:
'string"
"string`
»string'
What are the advantages and disadvantages of using borland c plus plus version 5?
The only advantage is that it is free. But it is disadvantaged by the fact it only supports Windows 95, 98, NT and 2000. Thus it is not compliant with the current C++ standard, and is only useful for legacy development upon these Windows platforms.
u(t)-u(-t)=sgn(t)
How do you reverse a given string without using string functions?
1.take while loop in which u continue up to null in array of string.
2.once u get null pointer then take a new array of same length.
3.when u get null there ll save position no in variable i.
4.take while loop i to 0;
5.and j=0 for new array.
6.in above loop copy old array to new array in each cycle of loop.
7.j++;
8.u ll get reverse of string.
How do you write a program that outputs a given characters in reverse?
write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)
What program in Turbo C that determines whether the input is vowel or consonant letter?
#include<stdio.h>
main()
{ char ch;
clrscr();
gotoxy(5,3); printf("*Identification of Consonant and Vowel letter*");
gotoxy(5,5); printf("*Please input a letter from A-Z in order to determine");
gotoxy(5,6); printf("if it is a CONSONANT or a VOWEL*");
gotoxy(5,8); printf("Enter a Letter: "); scanf("%c",&ch);
gotoxy(5,10); printf("Letter %c is a ",ch);
switch(ch)
{ case 'A':
case 'a':
case 'E':
case 'e':
case 'I':
case 'i':
case 'O':
case 'o':
case 'U':
case 'u': printf("VOWEL."); break;
default: gotoxy(5,10); printf("Letter %c is a CONSONANT.",ch); }
gotoxy(5,15); printf("Thanks you for trying this!"); getch();
}
You want many conditions to be satisfied for a single while loop how can you do it?
You can put as many conditional tests as you want in the while loop conditional location.
As a rule, however, it is a better idea to simplify the conditions as much as possible so that the reader of the code has a better understanding of what is being accomplished.
Once you start putting multiple conditions in a while loop with ANDs and ORs together, the logic can get complex and not well understood.
How does biconditional statement different from a conditional statement?
a condtional statement may be true or false but only in one direction
a biconditional statement is true in both directions
How did the compilers of hadis muhaddisin judge between acceptable and unacceptable hadis?
Compilers ensured that there was no conflict between the Hadith and the teachings of the
Qur'an, i.e. both the Qur'an and Hadith were in conformity and taught the same lessons. It
could be added that they compared the body (matn) of the Hadith with reason, the Qur'an
and other Hadiths to ensure that they agreed with the primary Islamic teaching. Answers
could be further elaborated to state that they ensured the chain of transmitters (isnad) was
unbroken and that the transmitter was a person of sound mind, good memory and upright
character. Examples of collectors going about their work could be given to answer
Advantage and distadvantage in hash table?
ANSWER A hash table is a way to find data in an array, when you have a known key and an unknown value that corresponds to the key. You use a hashing function on the key to create an index into the hash table containing the value. In the ideal case, this directly returns the corresponding value. In the usual case, a collision can occur. This means that the hashed key points to multiple possible values. A hash table is usually used on large arrays that would take a long time to search using other methods. A hash table can be very fast and use very little memory, and does not require the array to be sorted. The source code is slightly more complicated than some search methods. With a poorly designed hashing function when the hashed keys do not correspond one-to-one with the values, the secondary search after a hash collision can take a large amount of time.