answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

Why are few programs written in binary form?

The lower-level the language, the harder it is to write programs in. It takes a long time to write a program in machine language...and it is way more trouble than writing it in an abstracted language.

Write a program to change the case of the given string?

This functionality is already in Java. String.toLowerCase() and String.toUpperCase() will take care of it for you.

C progamme for conversion of Celsius to Fahrenheit using array?

main void void void (void)

{ float temp1 [13]= {1,4,2,3,4,5,7,88,9,4,3,23,12};

Write down the algorithm to delete a node from doubly linked list whose data item is given?

1. Find the element is the list. Let pointer 'p' point to it.

2. Delete it from the list:

if (p->Prev) p->Prev->Next = p->Next;

else List->First = p->Next;

if (p->Next) p->Next->Prev = p->Prev;

else List->Last = p->Prev;

3. Release the memory associated with it.

How are default parameters useful?

C itself does not support default values for function arguments, if that is your definition of parameter.

In languages that do, like C++/python/ and Java (presumably) you can use default parameters as a rudimentary form of polymorphism in the sense that you can call the function or method with a minimal set of arguments assuming the that others are defaulted to the values you want, this can be actual defaulted values like the number -1, or sentinel values that omit functionality in the function/method you are calling.

You will, in most of these languages that support this, have to arrange the position of the defaulted arguments to the end of the argument list, and in doing so it would be best to prioritize them from least likely to use the default value to the most from left to right. This in design time can conflict with function/method overloading where you vary the number of arguments in the prototypes of your overloaded function, so I consider these two features of a language mutually exclusive, i.e. don't use them together unless you have a good reason.

This feature is rarely useful but in saying "rarely" when it is, it is the most helpful. I find it and so do the creators of the C++ libraries helpful for class constructors when sometimes you need to set some internal features during construction time.

What are the logic formulation?

1. who are the people involved in programming?

2. tell us about logic formulation.

i hopr that you will answer my questions.


Maybe the right question is "What is a Logic Formulation". I would like to give my view on this.

Perhaps, the best way to understand "logic formulation" is by first knowing what "logic" is. In philosophy "logic" can be discussed endlessly but in so far as computer science is concern what we actually need is a simple application of it. Let me define "logic" as the grammar of correct thinking and reasoning. Take note of the conjunctive word "and" in the definition. Hence, two important elements must conform to define logic and that is (1) to think correctly and; (2) to reason out correctly. If one of the elements would be missing then no logic can be derived from.

The importance of logic in computer science is not as complicated as one might think of it philophically. Its use in programming is only for the purpose of bringing your instructions into proper order. Other than that, no further deductions or inference is needed. In writing instructions for the computer you have to take the individual steps comprising of the whole act to attain the desired results. Computer don't possess inherent power of thinking as human would demonstrate in the conduct of his task. Thus, each step must be taken and arranged according to the order of their priorities. These individual steps will make the instructions needed by the computer to execute its task. Each individual step is known as ALGORITHM.

Let us "MAKE COFFEE" to further illustrate this. When you want to make a coffee there are certain steps you need to do and so you can sip it in the end. Even us, human, cannot take all the steps at one time just to make coffee. Much so if computer is to make it for you. Computers works faster than human but despite of that tremendous speed computers will still take your instructions one at a time. So what are the steps in doing a cup of coffee? Let us consider:

  1. Get a cup
  2. Put a teaspoon of coffee into the cup
  3. Put a spoonful of sugar into the cup
  4. Pour hot water into the cup
  5. Stir it with spoon
  6. Drink (slowly)

As you can see, the above steps are arranged in LOGICAL order. Some of the steps like the 2nd to the 4th steps maybe interchanged without affecting the LOGICAL process but not steps 1, 5 and 6. But just to satisfy your curiosity try to do step 5 as your first step or perhaps 6th as your first. I just wonder what will become of your coffee as what would become of you in the face of those people watching you.

Clearly LOGIC FORMULATION simply means bringing the steps as required by the task in PROPER ORDER so that when it is executed procedurally the desired result is achieved according to the required output specification.

-Nilo M. Padre

How can you write TSR using C?

printf("TSR");

If you are talking about a terminate and stay resident DOS program, the easiest way to write a TSR is to use a TSR toolkit, which does all of the basic work for you. Otherwise, even to describe the process would take too long (it can be quite complex).

What is called Dividing a program into function and modules?

Modularisation. It could also be called refactoring, where large and complex functions are split into several simpler functions, making code easier to read. Refactoring can also help to reduce code duplication.

Who to Write a programme for addition of two 100 digit numbers in c language?

The native C language will not permit the addition of two 100 digit numbers with native data types. Therefore, you need to simulate the 100 digit numbers differently, and that can be done various ways, including using an arbitrary precision math package, or BCD arithmetic, etc.

Can exact amount of bits specified for integer data type in c?

1. Yes, but only inside data-structures with the 'bit fields'.

2. There is header called inttypes.h which gives you the following types: int8_t, int16_t, int32_t, int64_t (and unsigned variants).

What is a programmable timer?

A programmable timer usually just means a timer that can be programmed to go off at any time.

How type Punjabi?

If you want to type in punjabi, you have to download a font, i believe its Gurmikhi. But documents written using these fonts are not portable. Means you will require to carry the font along with your document if you want to use same document on some other system. Also you can not post content, written using these fonts, on websites (like your blog, community sites, etc).

You will rather require to write your content in UNICODE format. There are many Virtual Punjabi Keyboard (web based) which provides you such facility. You can try http://www.shriwaheguru.com/punjabi_keyboard.html

Algorithm to determine if a binary tree is complete binary?

There are many ways of checking for a complete binary tree. Here is one method:

1. Do a level order traversal of the tree and store the data in an array

2. If you encounter a nullnode, store a special flag value.

3. Keep track of the last non-null node data stored in the array - lastvalue

4. Now after the level order traversal, traverse this array up to the index lastvalue and check whether the flag value is encountered. If yes, then it is not a complete binary tree, otherwise it is a complete binary tree.

Which stage of building a fully executable program form C source code combine multiple files into an executable program?

It's actually 3 stages: preprocessing, compilation and linking.

Preprocessing deals with all the preprocessor directives (all lines beginning with #). So a line such as #include<stdio.h> will effectively copy/paste the contents of the stdio.h header in place of the directive. The header itself may also contain preprocessor directives and these must be processed prior to insertion. Macros are also processed at this stage and all comments are stripped out. The end result is a translation unit that contains pure C code with absolutely no macros, no directives and no comments whatsoever. The translation unit is usually stored in working memory, however your IDE may include a switch that allows you to examine the contents of the translation unit.

The compiler processes each translation unit in isolation. Since the compiler cannot see any other translation units, only names with internal linkage can be resolved at compile time. The compiler produces an object file from the translation unit. The object file contains machine code along with a table of any names that couldn't be resolved by the compiler (those with external linkage).

Once all translation units have been compiled, the linker can examine the object files and resolve the outstanding external linkage problems, essentially linking all the object files into a single executable.

Problems can occur at any stage. For instance, preprocessing could result in a macro expansion that generates code that cannot be compiled. The compiler cannot resolve these problems because the compiler never saw the macro, it only saw the code that was generated by the preprocessor. So although it can identify the problem in the translation unit, it cannot identify where that problem originated. This is why macros are so difficult to debug: the compiler cannot help you.

Aside from macro problems, the compiler can identify and help you resolve a wide range of problems in your code thus it pays to make use of it as much as possible. The compiler can also statically assert your assumptions, perform compile-time computations and optimise your code through inline expansion, thus ensuring your code is error free and operates at peak performance.

Link-time errors are more difficult to deal with, but usually mean you've violated the one-definition rule (ODR) in some way, either by providing two different definitions for the same name or by not providing any definition of a name.

Even if no errors occur and linking is successful, it does not mean your executable is error free. The computer will only do exactly what you've told it to do, but it cannot account for logic errors at runtime. Many of these can be caught at compile time by making prudent use of static assertions, however this isn't always possible so you should also provide "sanity" checks wherever necessary and include appropriate error handling wherever runtime logic cannot be guaranteed to hold.

Write an Algorithm for towers of hanoi?

#include
#include
void hanoi(int x, char from,char to,char aux)
{
if(x==1)
{
printf("Move Disk From %c to %c\n",from,to);
}
else
{
hanoi(x-1,from,aux,to);
printf("Move Disk From %c to %c\n",from,to);
hanoi(x-1,aux,to,from);
}
}
int main(void)
{
int disk;
clrscr();
printf("Enter the number of disks you want to play with:");
scanf("%d",&disk);
double moves=pow(2,disk)-1;
printf("\nThe No of moves required is=%g \n",moves);
hanoi(disk,'A','C','B');
getch();
}

When you're running a component within aspnet what account is it running under on windows xp ---windows 2000 windows 2003?

It runs on ASPNET (IIS Default Account) found under AD or Users and Computers. The password is autogenerated and DO NOT change the password. If done, there is a document by MS to resolve the issue. Kind regards, Imtiaz Hasham

SME IT Networks

Write a program that accept a sentence and print all the words starting with vowels?

import java.io.*;

class test

{

public static void main()throws IOException

{

String s,p="";

char ch;

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

int i,c=0;

//input statement

System.out.println("Enter any string");

s=br.readLine();

s=s+" ";

for(i=0;i<s.length();i++)

{

ch=s.charAt(i);

if(ch!=' ')

{

p=p+ch;

}

else

{

if(p.startsWith("a")p.startsWith("e")p.startsWith("i")p.startsWith("o")p.startsWith("u"))

{

c++;

System.out.println(p.toUpperCase());

}

p="";

}

}

System.out.print("Total Words Starting with Vowels="+c);

}

}

by :

Pradeep Sir

Infonet Global Solutions

E-Block new Tempo Stand, Rajaji puram,

Lucknow-17

mob:- +91-9450821737

What is the difference between interpreted and parsed?

Interpreted means - normally - the code is interpreted at run-time, while parsed (actually, it's "compiled") means the code is translated to a native object file at compile-time, and then executed. Compiled code is usually faster, also.

Is it better to write in cursive or in print?

It depends on what you're personally comfortable with AND whether or not you think others will be able to read it (if it is meant for others to do so). I personally write with a combination of boths cursive and print. It seems weird, but it is still clearly written and readable. With technology on the rise, it seems that the art of cursive (or handwriting, or just writing period) seems to going out the door.