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

Is the use of functions a more efficient use of a programmers time or the computers time?

Functions act as logical separations of functionality to help the developers keep their code organized and robust.

Generally you should code for readability and correctness, let the compiler worry about optimizing. As long as you are following proper CS principles, the compiler will generally do a better job of optimizing than you will.

What is the main function of sysexe files?

You mean 'SYS.EXE'? It is used under MS-DOS to make a floppy bootable.

Is momentum hamiltonian operator is hermitian operator?

The hamiltonian operator is the observable corresponding to the total energy of the system. As with all observables it is given by a hermitian or self adjoint operator. This is true whether the hamiltonian is limited to momentum or contains potential.

What is the calloc function in C programming?

calloc is memory allocation function that is normally used for requesting memory space at run time 4 storing data types such as arrays and structures. calloc allocates multiple blocks of storage, each of the same size and then sets all bytes to zero, and then returns a pointer to the memory.

When an array contains values other than primitive data types is it considered a control array?

Only if the non-primitive data types are actually controls, such as an array of label controls, or an array of edit boxes. However, a control array is still an array. The only difference is that the values will likely be resource handles (objects that refer or point to the actual object which will be stored elsewhere in memory) rather than an actual value itself. That is, an array of primitive data types stores the actual value in the array itself.

What is the work of argc and argv in c program?

The argc and argv identifiers in a (standardly declared) main function allow access to the command line arguments. The standard declaration is...

int main (int argc, char *argv[]) ...or... int main (int argc, char **argv)

The number of arguments is stored in argc. Since the name of the program is, by convention, always implicitly the first argument, then argc is always at least 1, even if there are no arguments.

Each argument, then, is stored in argc[i], where i ranges from 0 to argc-1. The name of the program is stored at argv[0], and further arguments are argv[1], argv[2], etc.

Normal convention is that each white space separated word on the command line is an argument. The exception is in the case of a quoted argument, in which case the entire quoted string, minus the quotes, is a single argument.

Is is an error to attempt to write to any argument. If parsing by side effect parsers, such as with strtok(), is to be done, a copy of the argument must be made.

Write a programme in C plus plus for creating a payslip?

Payslips come in many shapes and forms so it is not possible to provide a fully-working example without some additional information. However, the basic information on any payslip will be the employee's name, reference number and tax code, hours worked and at what rate, gross pay, tax, NI and nett pay, along with the year-to-date totals. Thus in order to create a payslip, you must draw this information from a database and format it so that it all prints within the bounds of a blank, pre-printed payslip.

For additional information I would suggest asking one of the many C++ programming forums. However, no-one is going to write the program for you unless you pay them handsomely. So do as much as you possibly can by yourself and only ask when you're stuck with a specific problem.

What is 2-opt local search algorithm?

A 2-opt local search algorithm is an algorithm that is applied when one wants to improve the value of a solution obtained previously through the use of a construction heuristic such as : nearest neighbor, farthest insertion, etc.

The 2-opt consists of:

1.'breaking' 2 connections leaving 4 nodes not connected;

2.connecting the 4 nodes with only 2 edges but in a different way from the initial solution (hence, changing the order by which the cities were organized);

3.checking if the value of this new solution is better than the previous;

repeat the procedure.

What is the basic usage of a c-arm?

A C-arms are used in medical settings. If one is interested in finding more information on the way C-Arms are used, it would be suggested visiting medical websites providing X-Ray equipment information and youtube channels.

Why and is not required for an array in scanf in c?

The name of the array means the address of the first element, so 'arr==&arr[0]'

How can you disconnet passtime plus system?

Yes, it is spliced into the starter, find the box, and study it. It's really simple, just unplug and replug - matching color to color.

Are C variables initialized to 0 by default?

Only global/static variables are, local variables aren't.

How do you write a program in C that calculates the area of a triangle given the three x and y coordinates of each corner of the triangle Alongside it must make use of structs.?

To calculate the area of a triangle you need

  1. to get the coordinates of the points of the triangles A = (xa, ya), etc (into a structure, eg user input and parsing, direct assignment in the program, etc)
  2. calculate area = abs( (xb*ya - xa*yb) + (xc*yb - xb*yc) + (xa*yc - xc*ya) ) / 2
  3. put the answer somewhere (eg onto stdout, in the struct for future use, etc).

Your structure would include (at a minimum) the coordinates of the points, eg:

struct triangle

{

int xa, ya;

int xb, yb;

int xc, yc;

};

then you would declare a structure to hold the points and use it to calculate the area, eg:

struct triangle t1;

t1.xa = 0; t1.ya = 0;

t1.xb = 5; t1.yb = 5;

t1,xc = 7; t1.yc = 7;

area = calculate_area(&t1);

To calculate the area, you could put it into a function:

calculate_area(tri)

struct triangle *tru;

{

area;

area = ()abs( (tri->xb * tri->ya - tri->xa * ... )) /* formula above */

return area;

}

I'll let you think about:

  1. what the return type ought to be;
  2. what type to use to store the triangle's points;
  3. any potential error trapping that may need to be done;
  4. what compiler options (and header files) you may need.

and put the program together.

Exactly what data you want to store in the struct (minimum the points, but you may want to store the area of the triangle as well - in future you could expand to include calculating the side lengths and angles)

What is the difference between interpretation and compilation in computer programming?

Interpretive languages compile blocks of code into machine code, execute them, and then move onto the next block. The blocks may be as little as a single statement, but once each statement is executed, the machine code is lost. This means that functions must be recompiled every time they are called. Ultimately, performance suffers because every block must be interpreted before it can be executed. Moreover, the program must always be executed within the interpreter; you cannot create standalone programs.

Compiled languages pre-compile the entire program to produce a standalone machine code executable. As a result, compiled programs execute many times faster than interpretive languages.

C++ and Java are both compiled languages however Java programs are compiled to byte code rather than machine code. The byte code must then be interpreted by the Java virtual machine in order to execute. As a result of this interpretation, Java programs do not perform well compared to equivalent programs written in C++.

What are the properties of data types?

When we enter a variable then we know it what type it belong ,but the compiler does not know it ,for knowing it we declare data types. Storage representations & machine instructions to handle constants differ from machine to machine.The variety of data types available allow the programmer to select the type appropriate to the needs of the application as well as the machine.

ANSI C supports 3 types of data types

1.Primary data types

2.Derived data types

3.User defined data types

JAVA has 2 types

1.In Built data types

2.User Defined datatypes

Write a program that read phrase and print the number of lower-case letter in it using function of counting?

write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program

How you can improve your programming skill?

1. Write programs

2. Debug programs

3. Repeat as needed

4. Make sure the programs do different things in different ways

5. Repeat as needed

6. Repeat as needed

7. ...