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

Is interrupt and huge is modifiers in c?

These are MS-DOS specific extensions in TurboC. You should forget them (it's 2012 now, you know, not 1985)

Sample program of arithmetic operation in assembly language?

The simple Assembly Programs:

mov ax,15

mov bx,45

add ax,bx

int 21

This is a simple Assembley programs that perform addition of two numbers

like 15,45 in above example

How we can Write a program in c plus plus to input values into a table sort these values in ascending order and print them on the screen in tabular form?

Use a multiset to sort the input automatically.

int main()

{ std::multiset<int> set;

int i;

while (std::cin >> i)

set.insert (i);

for (auto it=set.begin(); it!=set.end(); ++it)

std::cout << i << std::endl;

}

C program to find whether the given point lies inside or outside or in circle?

I'm not going to write the program for you, but the way to determine whether a point lies within a circle is very easy: just compare the distance between the point and the centerpoint of the circle with its radius. If the distance is smaller, it's inside the circle, if it's greater, then the point is outside.

You can calculate the distance between the point and the centerpoint using Pythagoras's method. If the point is at (PX, PY) and the centerpoint is at (CX, CY), the distance can be calculated as such:
DX = (CX - PX); // X distance
DY = (CY - PY); // Y distance
distance = sqrt( (DX * DX) + (DY * DY) );

What happens to a binary number n if you compute n mod 4?

The remainder of the division, by 4, is a number between 0 and 3. In the case of binary, this would maintain the last two bits of the original number.

Why would you use the array of pointers to pointers?

You would use an array of pointers to pointers whenever you wished to implement a dynamic multi-dimensional array of 3 or more dimensions. Every multi-dimensional array can ultimately be reduced to a one-dimensional array where each element is itself a one-dimensional array (an array of arrays). With fixed-size arrays, all elements can be allocated contiguously regardless of how many dimensions there are. Fixed size arrays can be allocated both statically (when the size is known at compile time) or dynamically (when the size is unknown at compile time). However with large arrays it is often necessary to divide the array into smaller subarrays each of which is allocated separately (non-contiguously with each other) and maintain a separate array of pointers to keep track of each of those subarrays. Although this consumes more memory than a contiguously-allocated array would, it has the added benefit in that each subarray need not be the same length, thus it can actually save memory overall. However, if we had several such arrays then we would need yet another array in order to keep track of them all, and this array would need to be an array of pointers to pointers.

What is forward reference?

Forward reference is a terminology of coding standards. It is in which a variable is used before declaring it.

How do you pass a one-dimensional array to user-defined functions?

In C++ you would pass a std::array if the array is fixed-length, otherwise you'd use a std::vector. Most object oriented languages will provide some method of passing a self-contained array object to a function.

In C and other non-object oriented languages you would pass a reference or pointer to the start address of the array along with a variable indicating the number of valid elements within the array. The array type will determine the size of each element.

What is difference between strcmpi and stricmp?

The strcmpi() function is identical to stricmp() function.

What are external variables?

The concept of external variable has different meanings from language to language. The primary context in which the phrase is used is in the C and C++ programming languages. The concept is commonly incorrectly explained on the web. Please refer to a real c++ programming text for finality. In C and C++, keyword extern means either of two things, dependent on context. When applied to the declaration of a variable , extern tells the compiler that said variable will be found in the symbol table of a different translation unit. This is used to expose variables in one implementation file to a different implementation file. It is important to understand that the external declaration is not resolved by the compiler, but instead by the linker, meaning that extern is a legitimate mechanism to install modularity at the compiler level; if, for example, you create a debug and a release version of a library , you can switch between the two simply by loading one or the other, without recompiling either library or the things dependent thereupon. When applied to the instantation of a variable, extern promotes that variable into the symbol table of the translation unit. This is frequently misunderstood to mean that the variable is global; this is incorrect. The variable must already be global for externality to make sense. What this actually means is that the symbol may be referenced from other translation units. There must be a single implementation of the variable somewhere, marked extern (typically in the header,) for other translation units to refer to the variable. Unfortunately, externality is frequently misrepresented as an issue of scope; scope has nothing to do with externality. Scope is an issue of symbol availability and symbol conflict resolution not terribly unlike namespaces. Externs are always global, and thus scope is essentially a foreign concept. Never the twain shall meet. It is incorrect to say that variables in global scope must be externed within the scope of any function that depends upon those globals. Two important uses of externality are common: preventing circular references (in a fashion similar to the section declarations of languages like Pascal) and preventing compiled dependency chains. In the latter case, consider the example of a video game with a large amount of graphic resources. If the game code is portable, the author cannot rely on compiler extensions like binary inclusion, and therefore must convert their resources to arrays and compile them into the application from source. Because those resources are physically huge, compiling them can take a long time. If these resources are kept each in their own translation unit, however, and referenced as extern from other TUs, then when those other TUs are recompiled, the graphics are just re-linked, meaning they only need to be compiled the once. The effect described above can serve a similarly important role in breaking the recompile chain which otherwise would form from a huge stack of inclusions, by keeping things in separate TUs and therefore modular at the linker level. The more granular such distinctions are, the further compile times drop, and the lower dependencies between modules become; as such, extern is a tremendously important yet rather subtle tool for the modern C/C++ developer.

How do you convert decimal number 203 to binary?

Sequentially divide it by two, rounding down each time and recording the remainder. Read that sequence of remainders backwards, and that is your binary value.

203 / 2 = 101 R 1

101 / 2 = 50 R 1

50 / 2 = 25 R 0

25 / 2 = 12 R 1

12 / 2 = 6 R 0

6 / 2 = 3 R 0

3 / 2 = 1 R 1

1 / 2 = 0 R 1

So 203 in decimal can be expressed as 11001011 in binary. Now we can confirm this:

1 * 128 + 1 * 64 + 0 * 32 + 0 * 16 + 1 * 8 + 0 * 4 + 1 * 2 + 1 * 1

= 128 + 64 + 8 + 2 + 1

= 203

Which language is source program written?

The Java language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities

What is adult syntax?

Syntax usually utilized by professionals to clearly communicate information with little to no ambiguity.

How does language empower and limit the expression of your thought?

Language empowers primarily because it is the medium through which you can express your thoughts to others. A command of language gives you the ability to express your idea simply and clearly, and also to employ rhetoric to add emphasis to your presentation when desired. Language is inevitably connected with cultural and usually ethnic heritage. These enrich our experience of life, but may also limit expression because of the built-in ways that languages can work. The very sounds of certain words, and the inherent associations with other words in the same language can cause a subtle pressure toward a certain analytic bias. Even structural differences between languages, and the logics employed in building a thought can influence the thoughts themselves. The tonal language of eastern cultures are examples.

What is difference between fundamental and derived data types?

The simple is that fundamental quantities can be changed its not constant always and derived Quantities is like to constant always it could not be change ever.

Convert the following number to binary B2Fh?

That looks like hexadecimal. Convert each hex digit to 4 binary digits: B = 1011, 2 = 0010, F = 1111, so the final result is 1011 0010 1111.

That looks like hexadecimal. Convert each hex digit to 4 binary digits: B = 1011, 2 = 0010, F = 1111, so the final result is 1011 0010 1111.

That looks like hexadecimal. Convert each hex digit to 4 binary digits: B = 1011, 2 = 0010, F = 1111, so the final result is 1011 0010 1111.

That looks like hexadecimal. Convert each hex digit to 4 binary digits: B = 1011, 2 = 0010, F = 1111, so the final result is 1011 0010 1111.