What is the importance of Swapping two variables?
Suppose we ask the user to enter a range with an upper and lower limit. We would naturally expect the upper limit to be higher in value than the lower limit. If this is not the case, we can either reject the values and ask for new input or we can simply swap them.
if we have an array of unsorted values and we wish to sort them, we need to exchange values. In order to exchange any two values we must swap them.
A local digital loopback is a test that is performed to check the transmitter and receiver of a local modem, or being simpler, it's a test that sends a signal to a remote receiver and waits for the signal to be returned.
What is the purpose of a stack in implementing a recursive procedure Explain?
there is no a prior limit on the depth of nested recursive calls (that a recursive function may call itself any no. of times), we may need to save an arbitrary number of register values(return values of the recursive functions, that may be used latter to find the actual solution). These values must be restored in the reverse of the order in which they were saved, since in a nest of recursions the last subproblem to be entered is the first to be finished. This dictates the use of a stack, or ``last in, first out'' data structure, to save register values. We can extend the register-machine language to include a stack by adding two kinds of instructions: Values are placed on the stack using a save instruction and restored from the stack using a restore instruction. After a sequence of values has been saved on the stack, a sequence of restores will retrieve these values in reverse order.
Vishal Srivastava
MCA, LU
source : http://mitpress.mit.edu/sicp/full-text/sicp/book/node110.html
What is the different between header file and header pointer?
Header file is a file which is meant to be included into another file during compilation. Examples: string.h, stdio.h, inttypes.h.
Header pointer is a pointer to an object called header (for example header of a linked list).
Write C program to find the sum of first 100 numbers?
#include<stdio.h> #include<conio.h> void main() { int n; printf("Enter any number"); scanf("%d",&n); sum=((n*(n+1))/2); printf("The sum of first 100 natural numbers is\t%d",sum); }
Which utility is used to create answer files for unattended installations?
windows system image manager(wsim)
What is the goal of information processing?
Information processing provides individuals with basic skills to use the computer to process many types of information effectively and efficiently.
Which structure is a logical design that controls the order in which a set statement executes?
Sequence
Why we avoid goto statement in c?
Edsger Dijkstra said, excessive usage and unstructured usage of goto may:
1. lead to a very bad/un-readable/un-structrured/complicated code
2. increase the complexity of debugging and analyzing the code
.
But there are some hidden-gotos that we use in C language
1. break
2. continue
3. return
.
Rules of thumb:
It is not very bad to use goto in any language if we follow the following rules
1. Always use gotos to jump to a forward location. Gotos are very useful in cleanup activities
2. Backward jump can always be accomplished by using continue inside a loop. This doesn't mean that we shouldn't use backward gotos. Backward gotos can be introduced when the code is very legible and it is not disrupting the structure and readability of the code and there are only a few backward gotos.
3. Use do { .... if(xx) break; ... } while(0); - type of coding will suite to most of the places where we need to use goto.
4. Usage of goto to jump into another code-block/scope is always bad. Instead strucure the code in such a way that goto-lables are placed at the start of the code-block/scope.
5. The primary-advantage of using goto when compared to its alternative ways is, goto is fast.
6. Avoid as much gotos in your code and use goto only when you feel that usage of goto's alternative ways will slowdown the execution or they increase the complexity or decrease the readability.
7. Make sure that usage of goto/break/continue/return is not creating any unreachable code
8. Keep in mind that usage of goto is near to punishable offence w.r.t some organization's/intuition's coding standards.
How do you get path of a DLL from inside the DLL itself?
http://www.codeproject.com/KB/DLL/DLLModuleFileName.aspx
How do you find out addition of all numbers between two inputed numbers in for loop?
First of all we will describe how our program should be working.
After entering number 1 and 5 I want it count 2 + 3 + 4 and return 9. After entering 4 and 9 it should count 5 + 6 + 7 + 8 and return 26. After entering X and X I should get 0. If I enter X and X - 1 I should get and error.
Here is the code of such application:
#include
int main() {
int firstNum, secondNum, sum, tmp;
printf("Please enter first number: ");
scanf("%d", &firstNum);
printf("Please enter second number: ");
scanf("%d", &secondNum);
if (secondNum < firstNum) {
printf("Sorry, second number must be higher than first one.\n");
return 1;
}
sum = 0;
for (tmp = firstNum + 1; tmp < secondNum; tmp++) {
sum += tmp;
}
printf("All numbers between %d and %d sum equals %d\n", firstNum, secondNum, sum);
return 0;
}
Testing:
Please enter first number: 1
Please enter second number: 5
All numbers between 1 and 5 sum equals 9
Please enter first number: 4
Please enter second number: 9
All numbers between 4 and 9 sum equals 26
What is meant by array loud speaker?
Array speakers, You can see it in the theaters, it is simply a large number of speakers hanging or placed vertically in the wall and it produce a uniform sound. It is used to reach the voice to each and every individual person in that theater.
By regards
udayan AR
When a function is used as an argument in another function?
It is called callback function. For an example see the qsort function.
Is it possible to initialize null character in string?
How do you find flames using string?
I'm not sure what your asking. Is flames another string or the contents of a string?
I can't answer your question because your either asking something way beyond or ask something that has no answer.
Is there any program to write pseudocode?
Yes, this program is the same as flowchart, pseudo code.
http://watts.cs.sonoma.edu/SFC/index.html
another option is to use Note Tab Light and the Pseudo code library.
http://www.notetab.com/libraries.php?cat=scripting
No. Pseudocode is, as the name suggests, not real code. Pseudocode is an abstract concept that is often used in literature to highlight a principle or solution without focussing on the syntax details of a specific computer programming language.
For example, one language might make assignments with the '=' operator, another one might require the use of ':=' or '<-'. Other languages might even control assignments in a totally different way, for example by implication such as in stack-oriented programming languages.
Some languages might provide an "else if" construct to further diversify the else-branch of an if-clause, while others might use the "elif" keyword, or a different construct.
These are syntax details of programming languages, and are often irrelevant when discussing more abstract concepts in a language-independent way. Pseudocode aims to provide an intuitive description. The fact that the reader knows this to be pseudocode means that nobody ought to argue about the position of a semicolon or the use of single versus double quotes; you'd know this is not the real code in any specific language, but probably close for easy implementation at least with functional languages.
For example, when describing a general-purpose algorithm to sort items in a sequential list, pseudocode might say
if a > b then
swap a, b
The reader is required to transcode pseudocode into the specific programming language intented (C, Basic, Pascal, Perl, whatever).
Pseudocode is often used when describing generic algorithms, such as sort algorithms.
How do you hide local variables in c and give precedence to global variables inside the function?
Hi, I would like to answr the question.So, if you want the to give more precedence to global variables with respect to a local one.Just add a pair of curly braces in the local variable and by doing so u can access global variable.
Greatest no among 3 number using nested if statement?
if (a > b && a > c) printf("%d\n", a);
else if (b > c) printf("%d\n", b);
else printf("%d\n", c);
What is looping statement in c language in Punjabi language?
ANSWER in PUNJAbi
22ji e ta bahut sokha hai..
looping statement di help naal asi program de kise v hisse nu vaar vaar chla sakde ha. man lo tussi apna naam 200 vaar print krana hai , ta "printf" command 200 var likhni peni hai, but looping di help naal asi e kam sirf ik vaar "Printf" likh k kar sakde haa. for(i=0; i<200; i++) { printf("gurpreet singh 3184/w"); }
int i=0;
while(i<200)
{
printf("gurpreetsingh3184/w");
i++;
}