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 are the array operations?

There are no array operations in C. Arrays implicitly convert to pointers, thus any operation you might attempt upon an array you would actually perform on a pointer.

What is standard input and output error file?

The C standard library provides stderr as the standard error file. It is an output file, much like stdout, except it cannot be redirected via the command line. By default, error messages via stderr are output to the console, the same as the undirected stdout. However, the programmer may choose to redirect stderr to a disk file or allow the user to choose a location via command line switches. Although error messages can also be output to stdout (or indeed to any output stream), it is best to keep error messages separate from the standard output stream. For instance, the user may choose to redirect standard output to a disk file or to the input stream of another program, while error messages are directed to the console.

Advantages and disadvantages of assembly language?

ADVANTAGES

reduced errors

faster translation times

changes could be made easier and faster

symbolic code is easier to read and follow

changes can be quickly and easily incorporated with a re-assembly

DISADVANTAGES

the programmer requires knowledge of the processor architecture and

instruction set

many instructions are required to achieve small tasks

source programs tend to be large and difficult to follow

programs are machine dependent, requiring complete rewrites if the

hardware is changed

Assembler languages are unique to specific types of computers.

Programs are not portable to other computers.

You have turbo c plus plus 4.5 versioni want to run graphics program in 'c'.But there will be an error bgi file not supported under window what would you do?

(1) Install the software DOSBox ver 0.72 ( 1.2 MB ) (Freeware) from the link below (Direct Link)

http://prdownloads.sourceforge.net/dosbox/DOSBox0.72-win32-installer.exe?download

(2) Before going to the details u have to create a folder (any name will do). Here we name it as Turbo

(3) Copy the TC into the Turbo folder. You can download Turbo C/C++ here.

(4) Run the DOSBox 0.72 from the icon located on the desktop or from the location of the installation folder

(5) Then u are presented with two screens which look like the command prompt in Windows. One with a Z prompt. You can ignore the other screen.

(6) Type the following commands at the command prompt [Z]:

Mount [Type in any alphabet that u wish except z] [Type the source of the turbo C] press enter

(7) Now , Type in the following commands after the Z prompt:

Z: mount d c:\Turbo\ [The folder TC is present inside the folder Turbo]

(8) Now u should get a message which says: Drive D is mounted as a local directory c:\Turbo\

(9) Type d: to shift to d: prompt . Next follow the commands below

CD TC [The contents inside the folder Turbo gets mounted as a virtual drive (Here D drive)

CD Bin

TC or Tc.exe [This presents u the Turbo C++3.0 screen]

(10) In the Turbo C++ goto Options>Directories> Change the source of TC to the source directory [D] ( i.e. virtual D: refers to original c:\Turbo\ . So make the path change to something like D:\TC\include and D:\TC\lib respectively )

===========================================================

Points to Note:

(1) In order to get the full screen use the key combination of Alt and Enter

(2) When u exit from the DosBox [precisely when u unmount the virtual drive where Turbo C++ 3.0 has been mounted] all the files u have saved or made changes in Turbo C++ 3.0 will be copied into the source directory(The directory which contains TC folder)

(3) It is a good idea to backup your files in the source directory prior to running DOSBox 0.72

(4) For additional help go through the readme file located in the installation folder or look on the website of the DOSBox forum.

(5) Don't use shortcut keys to perform operations in TC because they might be a shortcut key for DOSBOX also . Eg : Ctrl+F9 will exit DOSBOX rather running the code .

Write a c function for minimum and maximum value from the given input?

Assume that all your data were saved in array of type double and size 100:

int arrSize = 100;
double arr[arrSize] = {0.0};
...
for(int i = 0;...)
{
...
cin >> arr[i];//here you enter all elements using loop for

}
...

Out side of the function main you can define two functions max and min which take the array arr as argument

double min(const arr[], int arrSize)
{
double minimum = arr[0];
for (int j = 0; j < arrSize; j++)
{
if (minimum > arr[j])
{
minimum = arr[j];

}

}

return minimum;

}

double max(const arr[], int arrSize)
{
double maximum = arr[0];
for (int j = 0; j < arrSize; j++)
{
if (maximum < arr[j])
{
maximum = arr[j];

}

}

return maximum;

}

Draw 8 bit half adder?

=HA#0-
=FA#1-
=FA#2-
=FA#3-
=FA#4-
=FA#5-
=FA#6-
=FA#7=

It consists of seven Full-Adder and one Half-Adder, has 2*8 input lines and 9 output line (8+carry).

How do you code a character literal?

char c = 'a';

'a' is a literal character, which assigns the value 0x61 (ASCII code 97 decimal) to the char variable c.

The following lines are therefore equivalent:

char a = 0x61;

char b = 97;

char c = 'a';

What can be entered into spreadsheets?

Three types of data may be entered into a spreadsheet or worksheet: (1) values or numbers, (2) names or labels, and (3) formulas for calculation.

What is the format specifire of data type BYTE?

Nothing (actually there is no BYTE in C). Use one of these: %c %x %u %o %d.

If a program have 2 main methods can the program run or not?

No, a program may not work with two main methods. If we preferred with working with many packages means then each package may consist of a main method.

What does a char store?

In Java

A char in Java is a 16-bit integer, which maps to a subset of Unicode.

In C A char in C is an 8-bit integer, which maps to standard ASCII.

Note that in both Java and in C you can use a char value like a normal integer type: char c = 48;

Write a algorithm for a deque operations?

please read data structure (schaum series) books

Write a c program to find given number is prime or not?

Yes, do write, or if you're too lazy to your homework, use google.

Does anyone know if there was a 89TH Quartermasters Battalion Co C in the Philippines and if there was where?

The Philippine Scouts message board at www.philippine-scouts.org would be a good starting place for this question.

Write a program that asks the user to type two integers A and B and exchange the value of A and B?

// While this doesn't prompt the user for input, it does reverse the values' contents. $intA = '10';

$intB = '20';

$tmp = $intA;

$intB = $intA;

$intA = $tmp;

print $intA; // 20

print $intB; // 10 // An even quicker way is...

list($b,$a) = array($a,$b);

Why use pointer in c language with file handling?

Don't store pointers in files, it makes no sense.

What spices should be used when boiling a fresh ham?

Whole bay leaves would work well and a few whole pepper corns. Ham has it's saltiness to it so I wouldn't suggest using any salt in the water. Maybe a pinch of all spice in the water. Not too much or it will overpower everything else.

What is regular grammar of a for loops C programming language?

Something like this:

statement -> for (opt_expression; opt_expression; opt_expression) statement

statement -> while (expression) statement

statement -> do statement while (expression);

opt_expression -> | expression

What is null macro?

The NULL macro is an implementation-defined macro. It is used to symbolise the zero address (0x0) in C programs and older C++ programs. It is not type safe, but is the conventional method of assigning the zero address to a pointer variable. C++11 introduced the type-safe nullptr data type.

Can you mix new and malloc in the same C plus plus program?

Yes.

Note: This is generally a bad idea. Using delete on something you malloc'ed or free on something you new'ed usually will cause Bad Things to happen.

When filling out a w-2 form what is the difference between declaring a 1 or 2 dependents?

A deduyction for a dependent is worth about an $850 reduction in your taxable income. That, at whatever your rate would be is approximately the amount of lowering of tax withholding you will see. Of course, your ultimate tax is in no way effected by the amount of deductions claimed on your W-2, only the amount withheld from that subject payroll. If you don't have enough withheld (especially easy if you have income from other sources, like bank accounts or side jobs) you should make additional estimated payments or will be subject to penalties and interest.