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

What is the Data structures used for stack?

A stack is a linear last-in first-out list type data structure. Several implementations are possible. Two examples are the array and the linked list.

The array is quick, but is limited in size.

The linked list requires overhead to allocate, link, unlink, and deallocate, but (except for total available memory) is not limited in size.

One compromise might be a linked list of arrays. Another compromise might be to not necessarily unlink and delete when an element is popped off the stack.

A member function that allow the user of the class to change the value in a data member is known as?

I presume you mean C++, rather than C.

That type of function is known as a mutator function.

Why static variables are initialized to zero?

When a variable is declared, your computer assigns a section of memory to that variable. If the variable isn't initialized, there's no way of knowing what data is already stored in that section of memory, which can cause errors in your programs.

In managed languages, such as C#, this is done automatically at declaration. Although it's still good practice to initialize variables yourself.

How to Design a 4-bit counter that only counts even numbers?

246 CounterThe 74HC393 is a dual 4 bit TTL counter the two sets can be combined and with some tricky wiring you will be able to make it count only even numbers, but I will use a PIC12f675 MCU a small 8 pin device and with some very easy programing you will be able to count odd or even numbers, for more info on the last contact me by E-mail or my website http://www.patenttrade.net

- - - - -

Easy.

A four-bit counter counts from 0 (D1-D4 all low) to 15 (D1-D4 all high). If you only want it to count 0, 2, 4, 6, 8, 10, 12 and 14--IOW all the numbers where D1 is low--just ground D1 and run the clock twice as fast as you normally would.

How do you insert front in double ended queue?

the double linked list don't understanding that's why i am searching net.....

Can there be at least some solution to determine the number of arguments passed to variable argument list function?

Yes. Use a control parameter before the variable argument list that determines how many arguments will follow. E.g., the printf() function uses a string parameter as the control parameter. The number of escape sequences in the string determines the number of arguments that are expected to follow, and each escape sequence in the string is expanded from left to right according to the arguments that follow. A simpler approach is to pass the number of arguments that will follow as a named argument. E.g.,

void print_nums(int n, ...)

{

// n tells you how many numbers are to be expected in the va_list.

}

Answer

Yes, there can be solution.

#1: explicitly specifing:

extern void variadic_1 (int n, ...);

variadic_1 (3, "first", "second", "third");

#2: using terminator:

extern void variadic_2 (...);

variadic_2 ("first", "second", "third", NULL);

What is dummy loop?

A dummy loop is a programming construct that executes a set of statements repeatedly without performing any useful work or computation. It's often used for testing, to create delays, or to maintain program structure where a loop is syntactically required but no specific operations are needed. Additionally, dummy loops can serve as placeholders during development or debugging processes.

What operator reverses the meaning of a teststatement?

The operator that reverses the meaning of a test statement is the logical NOT operator, often represented as ! in many programming languages. When applied to a boolean expression, it negates the value: if the expression evaluates to true, applying the NOT operator makes it false, and vice versa. This allows for the inversion of conditions in control flow statements, such as if conditions.

What is a waterjet operator?

A waterjet operator is a skilled technician who operates waterjet cutting machines, which use high-pressure streams of water, often mixed with abrasives, to cut through various materials such as metal, stone, glass, and plastic. The operator is responsible for setting up the machine, programming cutting paths, and ensuring precision in the cutting process. They also conduct routine maintenance and troubleshoot any issues that arise during operation. This role requires a good understanding of machinery, material properties, and safety protocols.

Give the names of library functions included in string file?

strlen, strcpy, strcmp and many others. Consult your help system.

How do you find factorial of given number?

Factorials are the product of 1 and all the integers up to the given number.

Simply put,

5 factorial or 5! = 5*4*3*2*1

What is the use of header file stdbool.h?

stdbool header file use for a new data type that is boolean value

What is the product of the first 100 whole numbers?

The product of first 100 whole numbers will be 0.It is because 0 is also a whole number and any thing multiplied by 0 will give out answer to be 0,no matter how long the series is.

How does the inline mechanism in C reduce the run-time overheads?

inline functions are compiled very fastly and uses the free memory to boot it as soon as possible

How many character include in an identifier name in C?

The C99 standard (ISO/IEC: 9899:1999) has the following to say on the matter:

5.2.4.1 Translation limits

The implementation shall be able to translate and execute at least one program that contains at least one instance of every one of the following limits:

  • 127 nesting levels of blocks
  • 63 nesting levels of conditional inclusion
  • 12 pointer, array, and function declarators (in any combinations) modifying an arithmetic, structure, union, or incomplete type in a declaration
  • 63 nesting levels of parenthesised declarators within a full declarator
  • 63 nesting levels of parenthesised expressions within a full expression
  • 63 significant initial characters in an internal identifier or a macro name (each universal character name or extended source character is considered a single character)
  • 31 significant initial characters in an external identifier (each universal character name specifying a short identifier of 0000FFFF or less is considered 6 characters, each universal character name specifying a short identifier of 00010000 or more is considered 10 characters, and each extended source character is considered the same number of characters as the corresponding universal character name, if any)
  • 4095 external identifiers in one translation unit
  • 511 identifiers with block scope declared in one block
  • 4095 macro identifiers simultaneously defined in one preprocessing translation unit
  • 127 parameters in one function definition
  • 127 arguments in one function call
  • 127 parameters in one macro definition
  • 127 arguments in one macro invocation
  • 4095 characters in a logical source line
  • 4095 characters in a character string literal or wide string literal (after concatenation)
  • 65535 bytes in an object (in a hosted environment only)
  • 15 nesting levels for #included files
  • 1023 case labels for a switch statement (excluding those for any nested switch statements)
  • 1023 members in a single structure or union
  • 1023 enumeration constants in a single enumeration
  • 63 levels of nested structure or union definitions in a single struct-declaration-list

Footnote: Implementations should avoid imposing fixed translation limits whenever possible.

There is no practical reason to impose these limits within the compiler let alone to make these limits available to the programmer, hence there is no standard header that defines them. Even if there were, the information is of no use to you let alone to the compiler, given that the compiler cannot arbitrarily change your identifier name lengths to suit. After all, those identifiers are supposed to be portable!

If translation limits do exist for your specific compiler, then it should be documented. A C99 compliant compiler must meet (or exceed) the limits defined by the C99 standard but those limits are such that "ordinary", portable code should never exceed them. After all, an identifier is only useful if it is readable, but if you have several identifiers such that the first 63 characters are an exact match then your code is anything but readable.

-Write the syntax of the c while and do while statements using EBNF Assume the following nonterminals are already defined statement and expr?

The hash tag used before the name is mainly for Twitter. These tags, however, can also be used on Facebook and other social media networks. The tags basically link followers and friends of the message to a central site where they can post pictures, thoughts, and discussions. In this instance, the hash tag is asking a question that should receive timely responses from friends and followers.

What do you do when you receive the command 'Write C code to read input from user and save the input to a sequential file'?

Learn C! :-)

There are several functions in C that can be used to read input from the user, such as getc(), getchar(), and scanf(). Files can be written to using fprintf() and putc(). They can be opened with fopen() and closed with fclose().

C program for sorting the numbers?

C program for sorting the numbers is very basic, start writing it and if you are having problems, post your program here and a description of the problem and you will be helped.

If you are taking a computer course, how do you expect to pass exams if you have plagiarized someone else work for your assignments.

To print the name without using semicolon?

#include <stdio.h>

int main (void) { puts ("the name"); return 0; }