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

Can you access data in the middle of the stack?

Usually not, but it depends on the context, I mean what kind of stack are you talking about. For example in FORTH language word PICK and ROLL could be used.

How do you write while andfor loop to get sum of1to100 integer?

int i, sum;

/* example using while */

sum = 0;

i = 1;

while (i <= 100) {

sum += i;

++i;

}

/* example using for */

sum = 0;

for (i = 1; i <= 100; ++i) sum += i;

What is time complexity of random search?

The time complexity of random search can be considered O(1) in the best-case scenario, where a solution is found immediately, but in the average and worst-case scenarios, it can be O(n) or O(N), where N is the number of possible solutions. This is because random search may require checking many solutions before finding the optimal one, and since the search is random, there is no guarantee of efficiency. The effectiveness of random search heavily depends on the distribution of the solution space.

1979 Susan B. Anthony value?

Likely face value only, just very high grade uncirculated and proof coins have more than face values, none of the coins were struck in silver regardless of mintmarks or date. There is a variety of the 1979-P issue SBA coin referred to as a Wide Rim or Near Date type that does have more than face value.

Write an algorithm to remove an item from the top of the stack?

It is not possible to write a code to POP from the stack when there is no your stack implementation information.

Because of that I am going to talk more about Stack in computer architecture and there will be additional link to specific examples(-e).

In x86 architecture there is three registers (BP, SP and SS) which are connected with stack and only SP and SS is needed.

SS - Stack Segment (base register);

SP - Stack Pointer (offset);

This is how the POP instruction works:

# operand = [SS:SP] (top of the stack) # SP = SP + 2; (change SP to point to new top element)

What is meant by unsigned char?

Answer

An unsigned char is a byte; its value can be between 0 and (2^8) - 1 (i.e., 0-255).

Can you get a job with an online degree in business computer information systems?

Yes, it's all about marketing. How well can you market yourself? Many smaller places will want someone with the knowledge and not be so concerned about the degree or where it came from. That's the kind of place you need to find.

Which distributions of Linux are most suitable for multimedia education and programming and are available in multiple languages?

Most Linux distributions can handle most of those tasks just fine. The one major hurdle would be inter-language support. Ubuntu, Debian, Fedora, and OpenSUSE all have excellent translations in a wide variety of languages. They include or make it easy to install all of the multimedia codecs, compilers and IDEs, and have a large selection of educational Linux programs. Ubuntu even has a variant designed especially for education, know as Ubuntu Education Edition (formerly Edubuntu).

Run java codes in c?

You cannot unless you wrote some kind of translator. The only exception is NET which allows to run codes written in different languages using the same coding environment.

How do you find last char in c string?

(strlen(str) == 0) ? '\0' : str[strlen(str)-1]

What common programming language statement in your opinion is most detrimental to readability?

Well-written well-commented code should be perfectly readable by anyone fluent in the language being used. Poorly-written and undocumented code will be extremely hard to follow.

What do you mean by prime a loop?

prime a loop is that how mach time it executed either max time or minimum time

How do you get the top down on a 1994 Chrysler lebaron V6?

you pull the two latches above the sun visors and then there is a button on the center console

What should you use to compile a C program on many different platforms?

C programs can be compiled by any C compiler on any platform. The compiler must support the same or higher C standard that you've coded against and all platform specific code should be separated with conventional platform-dependent precompiler directives to ensure that only the code specific to the target platform is compiled.

In most cases the target platform will be dictated by the platform upon which the compiler is executing, however the same compiler will usually cater for both 32-bit and 64-bit compilations. Your IDE may also provide additional compilers via add-ons and plug-ins that allow compilation for similar architectures, such as games consoles and smart phones. Code for other platforms can often be tested using emulators.

What is 167 in decimal expressed in binary?

To express a number in binary, first we find the greatest power of 2 which is less than or equal to the value. The first powers of 2 are:

1, 2, 4, 8, 16, 32, 64, 128, 256, ...

The highest value we will use here is 128 (the 7th power of 2). So far we have:

10000000 (binary) = 128.

Next we need to subtract 128 from 167 to find the remaining value. 167 - 128 = 39. The next value we should use is 32 because it is the largest value still less than or equal to 39. Now we have:

10100000 (binary) = 128 + 32 = 160.

39 - 32 = 7, so now we choose a 4.

10100100 (binary) = 128 + 32 + 4 = 164.

Now a 2 and a 1 will finish the process.

10100111 (binary) = 128 + 32 + 4 + 2 + 1 = 167.

What are 3 different ways to implement an array of order 4x8?

An array of order 4x8 can either be implemented as a one-dimensional array of order 32 or as a one-dimensional array of order 4, where each element is a one-dimensional array of order 8. In either case, the 32 data elements are allocated contiguously and there is no difference in performance.

A third way is to implement the one-dimensional array of order 4 as an array of pointers to separately allocated one-dimensional arrays of order 8. The order 4 array is contiguous as are the order 8 arrays, however they need not be contiguous with one another other. This is the least efficient implementation due to the additional level of indirection required to navigate the array.

C programming for finding permutations?

To find the next permutation of an array ar:

  1. Find the highest index, i1 such that ar[i1] is the first of a pair of elements in ascending order. If there isn't one, the sequence is the highest permutation, so reverse the whole thing to begin again.
  2. Find the highest index i2, such that i2 > i1 and ar[i2] > ar[i1].
  3. Swap ar[i1] and ar[i2].
  4. The elements from ar[i1 + 1] to the end are now in descending order (a later permutation), so reverse them.

Disadvantage of writing OS in high level language such as C?

Nothing. Every modern OS is written in C, except for some little special parts (like interrupt-handling) that are written in Assembly.

What is inserting a node?

A number of data structures are made up of nodes joined together by pointers. Some examples are:

  1. Linked lists
  2. Binary trees
  3. Generalised trees
  4. Graphs

Each structure has its own algorithms for inserting nodes, but the general process is of allocating the node dynamically with malloc, and then setting its pointers to the address of adjacent nodes, and often those adjacent nodes' pointers to the address of the new node.

What is the concept of asterisk in c plus plus?

An asterisk in C++, such as int *data, is what's known as a pointer. A pointer is like a regular variable, but instead of holding a value, a pointer holds the memory location of the value.

It's a somewhat difficult concept, and you can learn more about it here:

See related links section below...