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

How do you separate digits in c plus plus?

Repeatedly divide the number by 10 and store the remainder (the modulo).

By way of an example, if the number were 12345:

12345 % 10 = 5 (first digit)

12345 / 10 = 1234

1234 % 10 = 4 (second digit)

1234 / 10 = 123

123 % 10 = 3 (third digit)

123 / 10 = 12

12 % 10 = 2 (fourth digit)

12 / 10 = 1 (fifth digit)

This algorithm forms the basis of number reversals. The following function demonstrates the most efficient way of reversing any number in the range -2,147,483,648 to 2,147,483,647, inclusive.

int RevNum( int num )

{

const int base = 10;

int result = 0;

int remain = 0;

do

{

remain = num % base;

result *= base;

result += remain;

} while( num /= base);

return( result );

}

What sort of condition is oligohydramnios?

Oligohydramnios occurs when a pregnant woman does not have enough amniotic fluid. It can cause improper development of the fetus. It is not a healthy condition.

What is scalar data structures?

A scalar variable can hold only one piece of data at a time. So in C, C++ and Java scalar data types include int, char, float and double, along with others. Scalar variables of the same type can be arranged into ascending or descending order based on the value.

Prasangax

Define non standard data types?

In programming, non-standard data types can be anything; a model for a house, a person, a bank account, a galaxy. They all have in common that they are created through composition of basic built-in data types such as integers, strings or floating point data types.

To define non-standard data types, programming languages typically provide three to four language tools:

Arrays can combine multiple entities of the same basic or non-standard type into as larger new type. When an array is viewed as its own data type rather than a simple accumulation of variables, the whole is more than the sum of its parts: in the C programming language, for example, an array of bytes defines a string or characters.

Structures can combine multiple entities of the same or different data types into one record, from which all record members are accessible at the same time. For example, a student's record might hold the name and date of birth for a single student.

Unions can combine multiple entities of the same or different data types into one record, from which only one record member is accessible at any one time. For example, a union containing the key characteristic of a geometric shape might contain the number of edges of a polygon as an integer number, or a sphere's radius as a floating point variable. The programmer needs an additional method to determine whether this union ought to be interpreted as the edge-count or the radius.

Object-oriented programming languages also support classes. In simple terms, classes are structures which also contain functions, not only data. (Note this is a radical simplification. Classes and object-oriented programming have more to offer than glorified data structures.)

Eg for forloop and while loop?

//Both loops will print out the alphabet {A-Z}

int i = 65;

while(i<65+26)

{

System.out.println((char)i);

i++;

}

...

for(int i=65; i<65+26; i++)

System.out.println((char)i);

As you can see, both loops accomplish the same thing. A while loop simply has a conditional statement that tells the loop what needs to be true for it to keep on looping.

A for loop is more concise: it has 3 parts: a starting value, a conditional statement, and a(n) action for what the loop should do after every iteration (in this case increase i by 1).

Average complexity of heap short algorithm?

The average heap short complexity is O(log n)

How can you proof that rate of convergence of Regula Falsi Method is 1?

You would have to use the Regula Falsi Method formula to prove that the answer is 1. There are two different types when it comes to the formula; simple fast position and double false position.

Is it true in programming c the last else is associated with nearest if?

An example might help:

if (exp) if (exp2) stmt2 else stmt3

equvalent with this:

if (exp) { if (exp2) stmt2 else stmt 3 }

if that's not what you want, use {braces}:

if (exp) { if (exp2) stmt2 } else stmt3

Where can you find a barrel for a J C Higgins 583 13?

This gun is a High Stnadard model 10. Try Numrich gunpartscorp.com

Jack First jackfirstgun.com or

Bob's Gun Shop gun-parts.com for parts.

Can you install one or more antivirus on a single machine Will the machine work slower?

The answer is yes, you can install as many anti virus programs as you want. However, with more than one it will run significantly slower and in the end, there is no advantage with having multiple virus programs as most have the same virus recognising database. I would recommend Norton Internet security, however AVG free edition is increasingly popular and free.

What are the early development in electronic data processing?

Electronic Data Processing (EDP) can refer to the use of automated methods to process commercial data. Typically, this uses relatively simple, repetitive activities to process large volumes of similar information. For example: stock updates applied to an inventory, banking transactions applied to account and customer master files, booking and ticketing transactions to an airline's reservation system, billing for utility services. Electronic data processing in the Volkswagen factory Wolfsburg, 1973 The first commercial business computer was developed in the United Kingdom in 1951, by the Joe Lyons catering organization. This was known as the 'Lyons Electronic Office' - or LEO for short. It was developed further and used widely during the 1960s and early 1970s. (Joe Lyons formed a separate company to develop the LEO computers and this subsequently merged to form English Electric Leo Marconi and then International Computers Ltd.)

Early commercial systems were installed exclusively by large organizations. These could afford to invest the time and capital necessary to purchase hardware, hire specialist staff to develop bespoke software and work through the consequent (and often unexpected) organizational and cultural changes. At first, individual organizations developed their own software, including data management utilities, themselves. Different products might also have 'one-off' bespoke software. This fragmented approach led to duplicated effort and the production of management information needed manual effort. High hardware costs and relatively slow processing speeds forced developers to use resources 'efficiently'. Data storage formats were heavily compacted, for example. A common example is the removal of the century from dates, which eventually lead to the 'millennium bug'. Data input required intermediate processing via punched paper tape or card and separate input to a repetitive, labor intensive task, removed from user control and error-prone. Invalid or incorrect data needed correction and resubmission with consequences for data and account reconciliation. Data storage was strictly serial on paper tape, and then later to magnetic tape: the use of data storage within readily accessible memory was not cost-effective. As with other industrial processes commercial IT has moved in all respects from a bespoke, craft-based industry where the product was tailored to fit the customer; to multi-use components taken off the shelf to find the best-fit in any situation. Mass-production has greatly reduced costs and IT is available to the smallest company. LEO was hardware tailored for a single client. Today, Intel Pentium and compatible chips are standard and become parts of other components which are combined as needed. One individual change of note was the freeing of computers and removable storage from protected, air-filtered environments. Microsoft and IBM at various times have been influential enough to impose order on IT and the resultant standardizations allowed specialist software to flourish. Software is available off the shelf: apart from Microsoft products such as Office, or Lotus, there are also specialist packages for payroll and personnel management, account maintenance and customer management, to name a few. These are highly specialized and intricate components of larger environments, but they rely upon common conventions and interfaces. Data storage has also standardized. Relational databases are developed by different suppliers to common formats and conventions. Common file formats can be shared by large main-frames and desk-top personal computers, allowing online, real time input and validation. In parallel, software development has fragmented. There are still specialist technicians, but these increasingly use standardized methodologies where outcomes are predictable and accessible. At the other end of the scale, any office manager can dabble in spreadsheets or databases and obtain acceptable results (but there are risks).

How do you terminate a non responsive program?

If you press Ctrl+Alt+Delete, open task manager and then click processes and find the exe file that the program uses to run in the list and terinate it. (In MS Windows).

Does array save memory?

No, it use memory, just like any other variable.

What is the mean of echoed in c language?

It has nothing to do with C-language, it simply means that when you press a key representing a character, the character appears on the screen.

What do you mean by deadcode elimination?

In compiler theory, dead code elimination is a compiler optimization used to reduce program size by removing code which does not affect the program. Dead code includes code that can never be executed (unreachable code), and code that only affects dead variables, that is variables that are irrelevant to the program. Consider the following example written in C. int foo() { int a = 24; int b = 25; /* Assignment to dead variable */ int c; c = a << 2; return c; b = 24; /* Unreachable code */} The variable b is assigned a value after a return statement, which makes it impossible to get to. That is, since code execution is linear, and there is no conditional expression wrapping the return statement, any code after the return statement cannot possibly be executed. (This would not be the case if there were a label after the return statement, which opens the possibility of there being a jump that places execution after the return statement.)

What relationship would to use where one record in a table is related to many records in another case?

That's what you call 1:n relation. An example is the 'father of' relation: everyone has only one father, but any male can have zero, one or more children.

What is structure alignment in C?

Structure alignment relates to the way objects in memory must be allocated according to the underlying architecture. For instance, a machine might expect an int to be aligned upon a 4-byte boundary. If that is the case then a structure with a member int must be aligned upon a 4-byte boundary and the int member offset from that boundary by some multiple of 4 bytes.

Consider the following:

struct X_ { char c; int i;

} X;

assert (sizeof(X)==sizeof(int)+sizeof(char)); /* oops */

Assuming sizeof(int) is 4 and sizeof(char) is 1 and that an int must be aligned on a 4-byte boundary, the actual length of this structure must be 8 bytes, not the 5 we expected. If it were anything other than 8, then an array of such structures would have misalignments in 3 out of every 4 elements. Note that in order to correctly align this structure, the compiler must insert 3 padding bytes immediately after the char member. This ensures that the int member is offset 4 bytes from the start of the structure. So long as the structure itself is aligned upon a 4-byte boundary (which it now will be because 8 is a multiple of 4), the int will always be correctly aligned.

Inserting padding bytes between members can often increase a structure's size far more than we might expect, particularly if there are many members. To avoid this, it is best to declare members in order of size, largest first. In this way, whenever padding is required, the padding is more likely to be placed at the end of the structure rather than between two or more members.

struct X_ {

char c;

int i;

char c2;

} X;

Given the same criteria as before, this structure would be 12 bytes in length. But by changing the order of the members, we can reduce this to just 8 bytes:

struct X_ {

int i;

char c;

char c2;

} X;

The reason this works is because a char can always be aligned on a 1-byte boundary, so two consecutive char members will easily fit inside a 4-byte word. Thus we only require 2 bytes of padding instead of 4.

Note that it is never safe to assume the lengths of any data type in C other than char which is always sizeof(char)==1. The lengths of all other types are measured in terms of a char, but will vary from system to system according to the underlying architecture. Always use the sizeof() operator to determine type lengths. Note that the sizeof() operator computes data type lengths at compile time, so there is no runtime cost, nor is there any need to store the return value.

Why use setcolor function in c graphics?

C language doesn't say anything about graphics, it is platform-dependent.

How would you describe the structure of a btree?

A binary tree can be empty, or consist of three parts: a 'value' (any type), and to binary trees, called as 'left child' and 'right child'