How do you initialize more than one variable in a for loop?
example with two variables (j and d):
for (i=0; i<10; ++i)
{
int j=1;
double d=8.0;
... more statements ...
}
What is the absolute machine code?
The very lowest possible level at which you can program a computer is in its own native machine code, consisting of strings of 1's and 0's and stored as binary numbers. The main problems with using machine code directly are that it is very easy to make a mistake, and very hard to find it once you realize the mistake has been made.
What is the difference between functions and variables?
Variables define a certain value, such as an integer, string, boolean value, etc. Functions are defined to run a certain task, and may or may not return a value. You can have a function that calculates the sum of two numbers and returns the sum once calculated.
How you can use while loop in place of select case?
While is NOT a replacement for SWITCH -- CASE
However , still if this is the requirement then , you can do this :
While (1)
{
if (case1 ) {}
if (case2 ) {}
:
:
:
if (case n ) {}
if (case default ) {}
} //end of while loop
A forward declaration. In all statically typed languages (such as C++), all types must be declared before they can be used. A function is a type (the return value defines its type), but the compiler only needs to know how the function is called, not how it is implemented, so the function definition does not need to be visible to the compiler before the function can be called. The definition can actually be placed in another translation unit entirely.
Note that a function definition is also a function declaration.
Forward declarations make it possible for two functions to be dependent upon each other.
A function declaration includes the return type, the name of the function and its argument types. The formal names of a function's arguments are not required in it's declaration, they are only required in its definition. A function's signature is the same as its declaration but excludes the return type. All calls to a function must match its signature. If the return type is used, it must be assigned to a type that is covariant with the declared type.
Function declarations are typically placed in header files. By including the header in every translation unit that uses the function, we ensure the function's declaration is consistent across all translation units. If the function is defined in the same header it is declared, then it must also be declared inline. Multiple definitions of the same function are permitted provided they are token-for-token identical, thereby adhering to the one definition rule (ODR).
How do i write a program in c langua ge for the implementation of binary search with output?
There are various ways to implement a binary search, but the simplest makes use of a sorted array. It must be sorted because we need to know where values are in relation to one another. That is, if we know that element X has the value Y, then all values less than Y must be in the first half of the array, and all values greater than Y must be in the second half of the array.
We begin by looking at the middle element of the array. If there is no middle element (the array is empty) then the value does not exist. But if the middle value holds the value we are looking for, we are done. Otherwise we compare values to decide which half of the array can be eliminated. We then repeat the process with the remaining half of the array.
How do you make a calculator in code block by using c?
#include<stdio.h>
#include<conio.h>
int main(void)
{
float a,b,c=0, d=0, e=0,f=0;
printf("Please enter two numbers:\n");
scanf("%f %f", &a, &b);
c=a+b;
d=a-b;
e=a*b;
f=a/b;
printf("The sum of %f and %f is :%f\n", a,b,c);
printf("The subtraction of %f and %f is :%f\n", a,b,d);
printf("The multiplication of %f and %f is :%f\n", a,b,e);
printf("The division of %f by %f is :%f\n",a,b,f);
getch();
}
Can you give an example of array using character variable in c program?
the example of array over charcter variables is char ["string"]
Why might you NOT want to implement paging in the DataGrid control as is?
You need to retrieve all of the data with each access to the page.
When we are talking about dereferencing in C we are talking about the pointers and how to get value from them, not address.
Dereferencing operator notation is "*".
Here is a simple example of dereferencing:
int num;
int pNum*;
pNum = # /* make pNum pointer point to numlocation in memory/stack */
*pNum = 7; /* setting pNum value to 7. Note! numvalue becomes 7 too, because pNum points to the same memory location as num */
Why the header files have .h extension only?
Hi...
It's pretty simple. The .h stands for the word "header." It's merely a C convention that has been used throughout the years.
Conceivably, you could have "header" or "include" files with different extensions - the .h is the convention.
John
it is prepared by auditor for taking action to complete their assignment in well manner.
Arrays whose size can be altered are known as?
Arrays whose size can be altered are known as dynamic arrays.
Constant values are expressions as well, still I don't think they are so hard to evaluate... well, in this case it is twelve
Using loop input 5 numbers and output its total sum?
Find largest of n numbers using shell programming?
arg_cnt=$#
arg_list=$*
biggest=$1
if [ $arg_cnt -eq 0 ]; then
echo "$RF there should be minimum 1 argument"
exit 1
fi
for each_arg in $arg_list
do
if [ $each_arg -gt $biggest ]; then
biggest=$each_arg
fi
done
echo " Biggest number is : $biggest \n"
exit 0
How do you read binary file using c command?
FILE* f
f = fopen ("file name", "br");
... fread (f, ...);
fclose (f);
C program for finding cube root of positive no?
#include "stdio.h"
#include "math.h"
int main()
{
double x;
printf("Enter the positive number.\n");
scanf("%lf", &x);
printf("Cube root of %lf is %lf.\n", x, pow(x, 1/3.0));
return 0;
}
What is the effect of dereferencing a null pointer variable?
You'd get a memory access violation. Nothing serious besides the fact that your program crashes (which is a good thing).