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.
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; }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?
main(
)
i=
1
;
x0,
x1,
x2;
f1,
f2,
f0,
t;
)
;
"\n
Enter the value of x0: "
)
;
"%f"
,&
x0)
;
"\n
Enter the value of x1: "
)
;
"%f"
,&
x1)
;
"\n
____________________________________________\n
"
)
;
"\n
iteration\t
x0\t
x1\t
x2\t
f0\t
f1\t
f2"
)
;
"\n
_____________________________________________\n
"
)
;
(
x0+
x1)
/
2
;
F(
x0)
;
F(
x1)
;
F(
x2)
;
"\n
%d %f %f %f %lf %lf %lf"
,
i,
x0,
x1,
x2,
f0,
f1,
f2)
;
(
f0*
f2<
0
)
x2;
x2;
while
(
fabs(
f2)
>
ESP)
;
"\n
________________________________________\n
"
)
;
"\n
\n
App.root = %f"
,
x2)
;
)
;
see the program
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 do you write a C program to find the volume of a cylinder?
#include
#include
#define pi=3.141593
void main()
{
float r,h,a;
clrscr();
printf("Enter the radius:\t");
scanf("%f",&r);
printf("\nEnter the hight:\t");
scanf("%f",&h);
a=pi*r*r*h;
printf("\n The area of cylinder is: %f",a);
getch();
}
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 */
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.
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;
}
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.