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 a processs BSS segment grow during program execution?

No. The size of the data segment (which includes the BSS) is determined at compile time and cannot change at runtime. The data segment stores all the program's constants, global variables and static variables, the total size of which can be determined at compile time and is therefore fixed at that point. BSS is an abbreviation of Block Start by Symbol and is used specifically to allocate all global and static variables that are either in an uninitialised state or are explicitly initialised to zero. Global and static variables initialised with non-zero values are allocated separately from the BSS, as are all the constants.

What material would be acceptable if installed in a loop?

Materials acceptable for installation in a loop typically include flexible piping systems made from polyethylene (PE), polyvinyl chloride (PVC), or cross-linked polyethylene (PEX). These materials offer good resistance to temperature changes and pressure variations, making them suitable for loop applications such as heating and cooling systems. Additionally, metals like copper and stainless steel can also be used in loops, provided they are properly insulated and protected from corrosion. Always consult specific engineering guidelines and local codes for material suitability.

What is Difference between index register and stack pointer?

An index register contains an address that can be used during effective address generation, often along with an offset in the instruction or in another register. This is most useful when accessing elements of arrays or structures. A stack pointer is a specialized index register that points to a region of memory that can store temporary elements, in a last-in-first-out structure, such as return addresses, parameters, and local storage for function calls.

What is step involve is using data file in c plus plus programming?

Declaration of file pointer

opening of file in desired mode.

performing the desired operation.

closing the file

Write a program to reverse a 5 digit number using function?

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

int reversenum(int original);

int main(int argc, char * argv[]){

int numval;

if(argc != 2){

printf("Please specify a number.\n");

exit(1);

}

numval = atoi(argv[1]);

printf("The reverse of %i is %i\n", numval, reversenum(numval));

return 0;

}

int reversenum(int original){

int returnval = 0;

int val = abs(original);

int sign = sgn(original);

while(val > 0){

returnval *= 10;

returnval += val % 10;

original /= 10;

}

returnval *= sign;

return returnval;

}

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.