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

Definition or function of hoe?

A hoe is an agricultural tool used for tilling the land. Tilling means breaking the ground and making it suitable for planting crops, fruits and vegetables.

Can you declare float variable as increment operator in for loop?

I don't really understand your question, but for example the following code is perfectly legal:

float f;

for (f=0.0; f<=1.00001; f += 0.1) printf ("%g\n", f);

How can a list of strings be stored within a two dimensional array?

Think of the strings as writing on lines of paper. Paper is a two dimensional surface. The computer array is the equivalent of the two dimensional paper.

What is platform dependency?

a language is called platform dependent only if its compilation and execution depends on underlying system. the system supporting is required here

How do you find the radius of a circle in C?

The following code example will prompt the user to provide the circumference of the circle, then print the diameter, radius, and area.

Code Example:#include #define fPI 3.141593F int main(void) { float fCircumference = 0.0; float fDiameter = 0.0; float fRadius = 0.0; float fArea = 0.0; printf("Enter the circumference of the circle: "); scanf("%f", &fCircumference); fDiameter = fCircumference / fPI; fRadius = fDiameter / 2; /* fCircumference / (fPI * 2) */ fArea = (fRadius * fRadius) * fPI; /* (fRadius 'squared') * fPI */ printf( "The circles diameter is: %f\n" "The circles radius is: %f\n" "The circles area is: %f\n", fDiameter, fRadius, fArea ); return 0; }

What is slack byte in structures in C?

it's a byte used for speed optimization. It aligns bytes so that the can be read from the structure faster.

Its an extra byte, sometimes placed between structure members to align other structure members on appropriate word, double word, or quad word boundaries. It is often necessary when mixing libraries between different vendors, so as to make sure the structures align correctly and have the proper performance. Slack byte control, in the Microsoft world, is controlled by the /zpx compiler parameter. I have also seen the need to deal with slack bytes when programming with mixed assembler and COBOL in a mainframe environment, in the working storage division.

Which condition is not necessary in dynamic stack?

in dynamic stack we don't have to initialize the size of array while in static stack we have 2 initialize it ......

How do you count the number of elements in an array using PHP?

Using the function "count".

<?php

$foo = array("John", "Jacob", "Jingleheimer", "Schmidt");

echo count($foo); // <-- outputs the number 4

?>

How to print the reverse of an array without using backward loop?

int youArray[arraysize] = {...};

...

for (int i = 1; i <= arraySize; i++)

{

cout << yourArray[arraySize - i] << endl;

...

}

...

Find a c program for Bisection method?

  1. #include
  2. #include
  3. #include
  4. #define ESP 0.001
  5. #define F(x) (x)*(x)*(x) + (x)*(x) + (x) + 7
  6. void

    main(

    )

  7. {
  8. int

    i=

    1

    ;

  9. float

    x0,

    x1,

    x2;

  10. double

    f1,

    f2,

    f0,

    t;

  11. clrscr(

    )

    ;

  12. printf(

    "\n

    Enter the value of x0: "

    )

    ;

  13. scanf(

    "%f"

    ,&

    x0)

    ;

  14. printf(

    "\n

    Enter the value of x1: "

    )

    ;

  15. scanf(

    "%f"

    ,&

    x1)

    ;

  16. printf(

    "\n

    ____________________________________________\n

    "

    )

    ;

  17. printf(

    "\n

    iteration\t

    x0\t

    x1\t

    x2\t

    f0\t

    f1\t

    f2"

    )

    ;

  18. printf(

    "\n

    _____________________________________________\n

    "

    )

    ;

  19. do
  20. {
  21. x2=

    (

    x0+

    x1)

    /

    2

    ;

  22. f0=

    F(

    x0)

    ;

  23. f1=

    F(

    x1)

    ;

  24. f2=

    F(

    x2)

    ;

  25. printf(

    "\n

    %d %f %f %f %lf %lf %lf"

    ,

    i,

    x0,

    x1,

    x2,

    f0,

    f1,

    f2)

    ;

  26. if

    (

    f0*

    f2<

    0

    )

  27. {
  28. x1=

    x2;

  29. }
  30. else
  31. {
  32. x0=

    x2;

  33. }
  34. i++;
  35. }

    while

    (

    fabs(

    f2)

    >

    ESP)

    ;

  36. printf(

    "\n

    ________________________________________\n

    "

    )

    ;

  37. printf(

    "\n

    \n

    App.root = %f"

    ,

    x2)

    ;

  38. getch(

    )

    ;

  39. }

How do you program in shell to print even no?

Solution 1: echo 2 4 6 8 10

Solution 2: seq 2 2 100

Addition of two numbers on plsql program?

--THE SUM OF TWO NUMBERS:

declare

a number(2);

b number(2);

c number(2);

begin

a:=&a;

b:=&b;

c:=a+b;

dbms_output.put_line(a ' + 'b' = 'c);

end;

C program to generate the first 50 prime number?

#include <stdio.h>

int main () {

int n, i, j, k;

printf ("2 ");

for (i=3,n=2; n<=50; i+=2) {

for (j=3,k=1; j<i-1; j+=2) {

if (i % j 1) {

printf ("%d ", i);

n++;

}

}

printf("\n");

return 0;

}

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.

How char data type is represented in the memory?

The char data type is a single 16-bit, unsigned Unicode character. It ranges from 0 to 65,535. They are not integral data type like int, short etc. i.e. the char data type can't hold the numeric values. The syntax of declaring a char type variable is shown as:

char caps = 'c';

How do you make a while loop go backwards?

Perhaps you meant something like this:

i=1-1; while (++i<=10) { printf ("%d\n"); } /* 1..10 */
i=10+1; while (--i>=1) { printf ("%d\n"); } /* 10..1 */