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.

500 Questions

Example of motivation?

User Avatar

Asked by Wiki User

Effective extrinsic motivation encourages a behavior by providing an external reward such as gifts, money, praise, power, recognition, etc.

What is language ego?

User Avatar

Asked by Wiki User

Language ego refers to a person's sense of self that is tied to their language or linguistic abilities. It affects how individuals perceive their own worth and intelligence based on their proficiency in a particular language. Language ego can impact communication, language learning, and social interactions.

What is an example of a logic error?

User Avatar

Asked by Wiki User

An example of a logic error is when a program runs without crashing but produces incorrect results due to a mistake in the logical flow of the code. For instance, if a program intended to calculate the average of a list of numbers instead multiplies them together by mistake, it would be a logic error.

What is the advantage of doubly linked list over singly linked list?

User Avatar

Asked by Wiki User

It's not that one is better than the other. They are used in different circumstances. A linear linked list is used like an array, with the added benefits of random insertion/removal of elements, etc. A circular linked list is often used as a buffer where one portion of the program produces data and another consumes it, such as in communications.

What is hetrogenious linked list?

User Avatar

Asked by Wiki User

A heterogeneous linked list is a linked list where each node can store different types of data. This is different from a homogeneous linked list where all nodes store the same type of data. Heterogeneous linked lists can be useful for scenarios where you need to store multiple types of data in a single list.

What is a circular singly linked lists?

User Avatar

Asked by Wiki User

A circular singly linked list is a data structure that contains a series of nodes where each node has a reference to the next node in the list. The last node in the list points back to the first node, creating a cycle. This allows for efficient traversal in both directions and can be used for tasks like implementing circular buffers or round-robin scheduling.

How do you implement a doubly linked list by using singly linked list?

User Avatar

Asked by Wiki User

To implement a doubly linked list using a singly linked list, you can create two nodes in each element of the singly linked list - one for the next element and another for the previous element. This way, each node will have access to both its previous and next nodes, effectively creating a doubly linked list structure using a singly linked list implementation.

What is heterogeneous linked list?

User Avatar

Asked by Wiki User

A heterogeneous linked list is a data structure where each node can store data of different types. This allows for a flexible way to organize and manipulate data that may vary in structure or content. Each node contains a pointer to the next node in the list, enabling traversal and manipulation of the data.

Give 10 difference between dda and bresenham algorithm?

User Avatar

Asked by Wiki User

  1. DDA algorithm involves floating-point operations, while Bresenham algorithm uses only integer operations.
  2. DDA algorithm calculates the exact position of each pixel, while Bresenham algorithm determines the closest pixel to the ideal line path.
  3. DDA algorithm can suffer from precision issues due to floating-point calculations, while Bresenham algorithm is more accurate and efficient.
  4. DDA algorithm is simpler to implement but slower than Bresenham algorithm.
  5. DDA algorithm is susceptible to rounding errors, while Bresenham algorithm is not.
  6. DDA algorithm can produce jagged lines due to rounding errors, while Bresenham algorithm generates smoother lines.
  7. DDA algorithm is suitable for both lines and circles, while Bresenham algorithm is primarily used for drawing lines.
  8. DDA algorithm can handle lines with any slope, while Bresenham algorithm is more efficient for lines with slopes close to 0 or 1.
  9. DDA algorithm involves multiplication and division operations, while Bresenham algorithm uses addition and subtraction operations.
  10. DDA algorithm is a general line drawing algorithm, while Bresenham algorithm is specialized for line drawing and rasterization.

What is the difference between doubly linked list and circular linked list?

User Avatar

Asked by Wiki User

A doubly linked list allows traversal in both directions (forward and backward) by having each node point to both its next and previous nodes. A circular linked list is a type of linked list where the last node points back to the first node, forming a circular structure. This allows continuous traversal through the elements without a definitive end.

Write a C program to accept the elements of a 3 x 3 matrix and find its sum of the major diagonal elements The program should print the given matrix along with its sum of the major diagonal elements?

User Avatar

Asked by Wiki User

#include <stdio.h>

#include <conio.h>

void main() {

int d[3][3] = { 1, 2, 6, 3, 8, 5, 5, 6, 7 };

int k = 0, j = 0;

int sum1 = 0, sum2 = 0;

for (j = 0; j < 3; j++) {

for (k = 0; k < 3; k++)

printf(" %3d", d[j][k]);

printf("\n");

}

for (j = 0; j < 3; j++) {

sum1 = sum1 + d[j][j];

}

k = 3 - 1;

for (j = 0; j < 3; j++) {

if (k >= 0) {

sum2 = sum2 + d[j][k];

k--;

}

}

printf("Sum of First diagonal= %d\n", sum1);

printf("Sum of Second diagonal= %d", sum2);

getch();

How do you find whether linked list is circular or not?

User Avatar

Asked by Wiki User

To determine if a linked list is circular, you can use the Floyd's cycle detection algorithm. This algorithm involves using two pointers moving at different speeds through the list, and if there is a cycle, the two pointers will eventually meet at the same node. If they don't meet and one of the pointers reaches the end of the list, then the list is not circular.

Main deffrent between c and cpp?

User Avatar

Asked by Wiki User

C is a procedural programming language, while C++ is a multi-paradigm programming language that supports both procedural and object-oriented programming. C++ has additional features such as classes, inheritance, and polymorphism that allow for more flexible and modular code design compared to C.

Common operation of singly linked list?

User Avatar

Asked by Wiki User

Common operations on a singly linked list include insertion (at the beginning, end, or specific position), deletion (from the beginning, end, or specific position), traversal (visiting each node in the list), searching (finding a specific value), and updating (modifying the value of a node).

C program to find sum of all elements of a matrix?

User Avatar

Asked by Wiki User

To find the sum of all elements in a matrix in C, you can use nested loops to iterate through each element and accumulate the sum. Here is a basic example:

#include <stdio.h>

#define ROWS 3
#define COLS 3

int main() {
    int matrix[ROWS][COLS] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
    int sum = 0;

    for(int i = 0; i < ROWS; i++) {
        for(int j = 0; j < COLS; j++) {
            sum += matrix[i][j];
        }
    }

    printf("Sum of all elements in the matrix: %d\n", sum);

    return 0;
}

Ladderized if or else conditional statement?

User Avatar

Asked by Wiki User

In a ladderized if-else conditional statement, multiple if-else blocks are used to check conditions in a hierarchical order. As soon as a condition is met, the corresponding block of code executes, and subsequent conditions are not checked. This approach helps streamline the logic flow and prevents unnecessary checks once a condition is satisfied.

What is a queses?

User Avatar

Asked by Wiki User

It seems like "queses" may be a misspelling or a typo. Did you mean "queso," which is the Spanish word for cheese? Queso is a popular ingredient in Mexican cuisine and is often used in dishes like nachos and quesadillas.

Find the sum of the digits of 33333333334 to the second power?

User Avatar

Asked by Wiki User

first you multiply 33333333334 by 33333333334

(if its kinda hard to count these, they both have ten 3's, and one 4)

and then you should get this:

1111111111155555555556

(for this one, there are eleven 1's, ten 5's, and one 6)

then you add all these digits together, and should get this:

67

***p.s. the reason why it's not 1156 is because, in the order of operations, you have to solve the exponents (to the second power) before you can start adding***

What is the difference between traversal and search?

User Avatar

Asked by Wiki User

Traversal is the process of visiting and processing each node of a data structure in a systematic way, often in a specific order, without the aim of finding a particular node. Search, on the other hand, is the process of looking for a specific node or element within a data structure based on certain criteria, such as value or key. Traversal is more concerned with exploring the structure as a whole, while search focuses on finding a specific element within the structure.

What are conditional statements?

User Avatar

Asked by Wiki User

Conditional statements are used in programming to make decisions based on certain conditions. They allow the program to execute different code blocks depending on whether a condition is true or false. Common conditional statements include if, else, and else if.

Differences between finite and infinite loop?

User Avatar

Asked by Wiki User

A finite loop executes a specific number of times based on its condition, while an infinite loop runs indefinitely without cessation. Finite loops have a predetermined endpoint, while infinite loops continue without a defined stopping condition until manually interrupted. Improperly written infinite loops can lead to system crashes or unresponsive programs.

Which is dummy operator in c?

User Avatar

Asked by Prasadh

In C, the sizeof operator can be considered a dummy operator because it does not perform any operations on the data but simply returns the size in bytes of a variable or a data type.

Whats the advantages of decimal search?

User Avatar

Asked by Wiki User

Decimal search is advantageous because it allows for greater precision in finding the desired value within a range, especially when the values being searched are continuous or have a narrow range of potential solutions. It can help to pinpoint the exact value without needing to iterate through a large set of values, saving computational resources and time.

What poet hated capital letters?

User Avatar

Asked by Wiki User

The poet who famously disliked using capital letters in his work is e.e. cummings. He believed that not using capital letters emphasized the equality of words and gave his poetry a more modern and unique look.

What are the limitations of getchar and scanf functions for strings?

User Avatar

Asked by Wiki User

cause getchar only read a character and scanf read only word before first space but not other words and letters.